Hello, trying to spin up a digitalocean kubernetes...
# general
b
Hello, trying to spin up a digitalocean kubernetes cluster and install a helm chart:
Copy code
"use strict";
const pulumi = require("@pulumi/pulumi");
const digitalocean = require("@pulumi/digitalocean");
const kubernetes = require("@pulumi/kubernetes");

const region = "sfo2";

const kubernetesVersion = "1.16.2-do.2";

const nodeSize = "s-1vcpu-2gb";
const nodeCount = 1;

const cluster = new digitalocean.KubernetesCluster(
    "kubernetes-cluster",
    {
        region: region,
        version: kubernetesVersion,
        nodePool: {name: "default", size: nodeSize, nodeCount: nodeCount}
    }
);

const kubeconfig = cluster.kubeConfigs[0].rawConfig;

const provider = new kubernetes.Provider("kubernetes-provider", {cluster, kubeconfig});

const chart = new kubernetes.helm.v2.Chart(
    "nginx-ingress-chart",
    {
        repo: "stable",
        chart: "nginx-ingress",
        version: "1.28.3"
    },
    {providers: {kubernetes: provider}});

const controllerStatus = chart.getResourceProperty(
    "v1/Service",
    "nginx-ingress-chart-nginx-ingress-controller",
    "status");

const ipAddress = controllerStatus.apply(status => status.loadBalancer.ingress[0].ip);

module.exports = {ipAddress};
I get
TypeError: Cannot read property 'status' of undefined
. I think it might have something to do with pulumi trying to install the chart before the cluster/provider is created (?). The resource tree shows the chart but not its "contents":
Copy code
Type                                     Name                 Plan       Info
 +   pulumi:pulumi:Stack                      test-do-k8s-do-k8s   create     1 error
 +   ├─ kubernetes:helm.sh:Chart              nginx-ingress-chart  create     
 +   ├─ digitalocean:index:KubernetesCluster  kubernetes-cluster   create     
 +   └─ pulumi:providers:kubernetes           kubernetes-provider  create
c
I got a similar problem not too long ago. I believe the resource name provided in the
getResourceProperty
call should also include the namespace. I think there was another user in this channel about a month or so ago who hit the same problem.
b
I'll give that a try. I am confused by the resource tree not showing the deployments, etc under the chart. Does it work in your case, @clever-sunset-76585?
c
Is that resource tree snippet in your message above from the preview phase? I think that the chart's resources are not determined until the actual update. cc @gorgeous-egg-16927
b
yes, it is
I commented out the getResourceProperty part (but not the chart) and while it "suceeds" I don't see anything nginx-ingress-related deployed
g
You should see all of the subresources of the Helm chart, both during preview and update. I think the problem may be
Copy code
const provider = new kubernetes.Provider("kubernetes-provider", {cluster, kubeconfig});
You shouldn’t need the cluster arg, just the kubeconfig. Here’s a TypeScript example: https://github.com/pulumi/examples/blob/master/digitalocean-ts-k8s/index.ts
The cluster arg is for the name of the cluster (and is usually not needed): https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/kubernetes/#ProviderArgs-cluster
b
Thanks, @gorgeous-egg-16927, you are right that the
cluster
arg was wrong. But removing it makes no difference.
Creating a
Deployment
, as in the example you linked, works.
It's helm charts it seems to have trouble with
I have tried with the wordpress chart to double check, doesn't work either
Copy code
const wordpress = new kubernetes.helm.v2.Chart("wpdev", {
        repo: "stable",
        version: "2.1.3",
        chart: "wordpress",
    },
    {providers: {kubernetes: provider}});
(copied from some official example, only added the
{providers:...}
part)
g
Can you instead try
Copy code
const wordpress = new kubernetes.helm.v2.Chart("wpdev", {
        repo: "stable",
        version: "2.1.3",
        chart: "wordpress",
    },
    {provider: provider});
Note the changed provider line
b
same result
(i.e. chart displayed as created but no actual kubernetes resources listed or visible through
kubectl
)
g
Hmm, that’s odd. Would you mind filing an issue on the pulumi-kubernetes repo with the program and what versions of CLI and providers you’re running?
b
sure