Apply a Pod whose variables are filled in by the cluster:
sh
kubectl apply -n caverns-1551u3x -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: whoami
spec:
containers:
- name: box
image: busybox
command: ["sleep", "3600"]
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
EOFPrint the three variables from inside with kubectl exec whoami -n caverns-1551u3x -- env, and compare the IP with kubectl get pod whoami -n caverns-1551u3x -o wide.