I'd like to get the instance ID (e.g. AWS EC2 instance ID like i-19a9fa9s8df9a8, not the private dns node name) of where my pod is running from within my k8s config file, but couldn't find any documentation on how to do that. Anybody know how to use the reportingInstance
field in https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#event-v1-core?
I'm getting this error:
The DaemonSet is invalid:
spec.template.spec.containers[0].env[8].valueFrom.fieldRef.fieldPath:
Invalid value: "core.reportingInstance":
error converting fieldPath: field label not supported: core.reportingInstance
This is what I tried:
- name: INSTANCE_ID
valueFrom:
fieldRef:
fieldPath: core.reportingInstance
I already have this in my yaml file but that gives the private dns name not the instance ID
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName