CertKeen

Certified Kubernetes Application Developer (CKAD) · Free practice question 2 of 12

Downward API Pod IP as env

An app at Tregothnan Tea must log its own Pod IP address at startup, read from an environment variable named MY_POD_IP. Which env entry supplies it?

  1. A.{name: MY_POD_IP, valueFrom: {configMapKeyRef: {name: pod, key: ip}}}
  2. B.{name: MY_POD_IP, value: $(POD_IP)}
  3. C.{name: MY_POD_IP, valueFrom: {resourceFieldRef: {resource: status.podIP}}}
  4. D.{name: MY_POD_IP, valueFrom: {fieldRef: {fieldPath: status.podIP}}}
Show answer and explanation

Correct answer: D. {name: MY_POD_IP, valueFrom: {fieldRef: {fieldPath: status.podIP}}}

Why: The downward API exposes Pod fields to environment variables through valueFrom.fieldRef, and status.podIP is a supported field path. resourceFieldRef is for container requests and limits, $(POD_IP) only expands variables already defined in the container, and a ConfigMap cannot know each Pod's IP.

More free Certified Kubernetes Application Developer (CKAD) questions