CertKeen

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

Generating a Pod manifest skeleton

During a timed task, a developer at Poldark Ceramics wants a starting YAML file for a Pod called `kiln` running nginx:1.29 with label tier=web, written to kiln.yaml without creating anything. Which command produces it?

  1. A.kubectl run kiln --image=nginx:1.29 --labels=tier=web --dry-run=client -o yaml > kiln.yaml
  2. B.kubectl run kiln --image=nginx:1.29 --labels=tier=web --dry-run=server > kiln.yaml
  3. C.kubectl create pod kiln --image=nginx:1.29 --labels=tier=web -o yaml > kiln.yaml
  4. D.kubectl get pod kiln --image=nginx:1.29 -o yaml --export > kiln.yaml
Show answer and explanation

Correct answer: A. kubectl run kiln --image=nginx:1.29 --labels=tier=web --dry-run=client -o yaml > kiln.yaml

Why: kubectl run creates a Pod, and --dry-run=client -o yaml prints the object it would send without contacting the cluster for creation, which makes a quick skeleton. There is no `kubectl create pod` generator. --dry-run=server without -o yaml prints only a one-line message, and kubectl get reads existing objects (the --export flag was removed long ago).

More free Certified Kubernetes Application Developer (CKAD) questions