CK.I · CKAD practice question

You need to pass a Pod's metadata.name and metadata.namespace as environment variables POD_NAME and POD_NAMESPACE into a container. Which env entry achieves this?

Choose one answer
Check answer and explanation

Correct answer: valueFrom: { fieldRef: { fieldPath: metadata.name } }

Explanation

Using env[].valueFrom.fieldRef with fieldPath: metadata.name (and metadata.namespace) injects Pod object fields directly into container environment variables.

Common trap

Using env[].valueFrom.fieldRef with fieldPath: metadata.name (and metadata.namespace) injects Pod object fields directly into container environment variables.

Source: Original unofficial practice; not an official CKAD exam item
Checked against the cited text on 2026-11-30.

Report an error in this question