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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment