nerdexam
SAP

C_CPE_2409 · Question #49

Which command is used to create a Pod in Kubernetes from a YAML file?

The correct answer is D. kubectl create -f. kubectl create -f <file>.yaml is correct because the -f flag specifies a file, and create is an imperative command that instantiates resources defined in that YAML manifest. Option A (kubectl run) is used to run a single container image directly, not to apply a YAML file…

Deployment

Question

Which command is used to create a Pod in Kubernetes from a YAML file?

Options

  • Akubectl run <file>.yaml
  • Bkubectl get pod
  • Ckubectl apply
  • Dkubectl create -f

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    6% (2)
  • C
    3% (1)
  • D
    87% (27)

Explanation

kubectl create -f <file>.yaml is correct because the -f flag specifies a file, and create is an imperative command that instantiates resources defined in that YAML manifest. Option A (kubectl run) is used to run a single container image directly, not to apply a YAML file. Option B (kubectl get pod) is a read operation that lists existing Pods - it creates nothing. Option C (kubectl apply) is close and also accepts -f, but without the flag it is incomplete and would error; more importantly, apply is the declarative approach used for updates and reconciliation, whereas create is the classic imperative way to instantiate a resource for the first time.

Memory tip: Think "Create needs a File" - kubectl create -f. The -f flag is your bridge from a YAML file to a live Pod.

Topics

#Kubernetes#kubectl#Pod creation#YAML

Community Discussion

No community discussion yet for this question.

Full C_CPE_2409 Practice