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

damp-notebook-63293

10/09/2019, 7:36 AM
Is it just me or Pulumi has trouble interpolating values using Downward API? I have the following set in my Deployment, but
DISCOVERY_HOSTNAME
resolves to a blank value.
Copy code
env: [
  {
    name: 'DISCOVERY_HOSTNAME',
    valueFrom: {
      fieldRef: {
        fieldPath: 'status.podIP'
      }
    }
  },
],
g

gorgeous-egg-16927

10/09/2019, 3:31 PM
It worked when I tried the following:
Copy code
const appLabels = { app: "nginx" };
const deployment = new k8s.apps.v1.Deployment("nginx", {
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: {
                containers: [
                    {
                        name: "test-container",
                        image: "<http://k8s.gcr.io/busybox|k8s.gcr.io/busybox>",
                        command: ["sh", "-c"],
                        args: ["while true; do echo $MY_POD_IP; sleep 10; done;"],
                        env: [
                            {
                                name: 'MY_POD_IP',
                                valueFrom: {
                                    fieldRef: {
                                        fieldPath: 'status.podIP'
                                    }
                                }
                            },
                        ],
                    },
                ],
            },
        },
    },
},
);
Copy code
$ kubectl logs nginx-0trh4a3d-6745788d76-2qrvk
10.1.7.68
d

damp-notebook-63293

10/10/2019, 1:01 AM
Interesting. I must have it wrong somewhere. Thank you for the reply