What command is used to create a Pod named "my-pod" from an nginx image?
- kubectl apply -f my-pod.yaml
- kubectl new pod my-pod nginx
- kubectl run my-pod --image=nginx ✓
- kubectl create pod my-pod --image=nginx
Correct answer: kubectl run my-pod --image=nginx
Option C is correct because the imperative command to create a pod directly from a container image is kubectl run, and the syntax kubectl run my-pod --image=nginx creates a pod named my-pod running the nginx image. Option A uses kubectl apply -f, which requires a pre-existing YAML manifest file; it is declarative and will not work without that file. Option B is not a valid kubectl command; the subcommand new does not exist in kubectl. Option D uses kubectl create pod, which is not a supported form of the create subcommand for pods in the way shown; kubectl run is the correct imperative command for pod creation.
Topic: · kubernetes, kubectl, pod creation, ckad