Created
August 6, 2020 21:15
-
-
Save magickatt/6eeafd1d3f93c67b27a7b8d6e94cc7d1 to your computer and use it in GitHub Desktop.
Expose Kubernetes Pod UID as an environment variable to a container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Hello, do you know how to expose k8s.cluster.name as well?