Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Expose Kubernetes Pod UID as an environment variable to a container
apiVersion: v1
kind: Pod
metadata:
name: example-uid
spec:
containers:
- name: test
image: busybox
command: ["/bin/sh", "echo", "$EXAMPLE_UID"]
env:
- name: EXAMPLE_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
@alupuleasa
Copy link

alupuleasa commented Aug 26, 2022

Hello, do you know how to expose k8s.cluster.name as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment