nerdexam
Docker

DCA · Question #101

Does this command display all the pods in the cluster that are labeled as 'env: development'? Solution: 'kubectl get pods --all-namespaces -label env=development'

The correct answer is B. No. The provided command uses an incorrect flag for label selection, thus it will not display pods with the specified label.

Submitted by minji_kr· Apr 18, 2026Container Orchestration

Question

Does this command display all the pods in the cluster that are labeled as 'env: development'? Solution: 'kubectl get pods --all-namespaces -label env=development'

Options

  • AYes
  • BNo

How the community answered

(30 responses)
  • A
    7% (2)
  • B
    93% (28)

Why each option

The provided command uses an incorrect flag for label selection, thus it will not display pods with the specified label.

AYes

The `-label` flag is not a valid or recognized option for filtering Kubernetes resources by label in `kubectl get` commands.

BNoCorrect

No. The `kubectl get pods` command requires the `-l` or `--selector` flag to filter resources based on labels, not `-label`. Without the correct flag, the command will not apply the label filter as intended.

Concept tested: Kubernetes label selection syntax

Source: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#listing-getting-resources

Topics

#kubectl commands#Kubernetes labels#Pod management#Command syntax

Community Discussion

No community discussion yet for this question.

Full DCA Practice