https://pulumi.com logo
#general
Title
# general
b

billowy-secretary-44583

01/13/2020, 2:23 PM
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

clever-sunset-76585

01/13/2020, 4:15 PM
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

billowy-secretary-44583

01/13/2020, 4:22 PM
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

clever-sunset-76585

01/13/2020, 4:24 PM
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

billowy-secretary-44583

01/13/2020, 4:33 PM
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

gorgeous-egg-16927

01/13/2020, 5:23 PM
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

billowy-secretary-44583

01/13/2020, 7:06 PM
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

gorgeous-egg-16927

01/13/2020, 7:53 PM
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

billowy-secretary-44583

01/13/2020, 8:31 PM
same result
(i.e. chart displayed as created but no actual kubernetes resources listed or visible through
kubectl
)
g

gorgeous-egg-16927

01/13/2020, 8:37 PM
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

billowy-secretary-44583

01/13/2020, 8:37 PM
sure
2 Views