damp-notebook-63293
10/09/2019, 7:36 AMDISCOVERY_HOSTNAME
resolves to a blank value.
env: [
{
name: 'DISCOVERY_HOSTNAME',
valueFrom: {
fieldRef: {
fieldPath: 'status.podIP'
}
}
},
],
gorgeous-egg-16927
10/09/2019, 3:31 PMconst 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'
}
}
},
],
},
],
},
},
},
},
);
$ kubectl logs nginx-0trh4a3d-6745788d76-2qrvk
10.1.7.68
damp-notebook-63293
10/10/2019, 1:01 AM