How to use the instance ID in Daemonset config file in Kubernetes? How to use the instance ID in Daemonset config file in Kubernetes? kubernetes kubernetes

How to use the instance ID in Daemonset config file in Kubernetes?


Let me answer this with my understanding of your question. i think you want your node name value set as env variable in your container. If this is true you can use below code for that

 - name: Node_Name      valueFrom:        fieldRef:          fieldPath: spec.nodeName

If you want some other information about pod or container, please understand that you can get only limited information within container using downward api and that is limited to below mentioned field.

 fieldRef     <Object> Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels, metadata.annotations, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP.resourceFieldRef     <Object> Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.