nerdexam
Docker

DCA · Question #102

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

The correct answer is A. Yes. This command correctly uses the short form of the label selector flag (-l) to filter pods by the specified label across all namespaces.

Submitted by fatema_kw· 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 -I env=development'

Options

  • AYes
  • BNo

How the community answered

(67 responses)
  • A
    93% (62)
  • B
    7% (5)

Why each option

This command correctly uses the short form of the label selector flag (`-l`) to filter pods by the specified label across all namespaces.

AYesCorrect

Yes. The `kubectl get pods` command with the `-l` (or `--selector`) flag is the correct way to filter Kubernetes resources by label, and `--all-namespaces` ensures it searches across the entire cluster. Therefore, this command will display all pods labeled 'env: development' from all namespaces.

BNo

The `-l` flag is the correct and standard way to specify a label selector for filtering resources in `kubectl get` commands.

Concept tested: Kubernetes label selection

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

Topics

#kubectl commands#pod labeling#resource filtering#namespace awareness

Community Discussion

No community discussion yet for this question.

Full DCA Practice