
Answer-first summary for fast verification
Answer: kubectl get pods -l "app=prod"
The correct answer is `kubectl get pods -l "app=prod"`. This command lists all pods with the label 'app=prod', which was assigned to the nginx deployment. Using `gcloud` commands to list pods is incorrect because `gcloud` does not interact with Kubernetes pods directly. Similarly, listing deployments with `kubectl get deployments --output=pods` does not provide pod identifiers. For more details, refer to the Kubernetes documentation on listing all running container images.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You have created a Kubernetes deployment named nginx with the image 'nginx' and labeled it 'app=prod'. Your Kubernetes cluster hosts multiple deployments. How would you identify the pods specifically for this nginx deployment?
A
kubectl get deployments --output=pods
B
gcloud get pods --selector="app=prod"
C
gcloud list gke-deployments --filter={ pod }
D
kubectl get pods -l "app=prod"
No comments yet.