ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 58 - DCA discussion

Report
Export

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'

A.

Yes

Answers
A.

Yes

B.

No

Answers
B.

No

Suggested answer: B

Explanation:

= The commandkubectl get pods --all-namespaces -label env=developmentisnot validbecause it has asyntax error. The correct syntax for listing pods with a specific label iskubectl get pods --all-namespaces --selector label=valueorkubectl get pods --all-namespaces -l label=value. The error in the command is:

The option flag for specifying thelabel selectoris--selectoror-l, not-label. For example,-label env=developmentshould be--selector env=developmentor-l env=development.

The correct command for listing all the pods in the cluster that are labeled asenv: developmentis:

kubectl get pods --all-namespaces --selector env=development

This command will display the name, status, restarts, and age of the pods that have the labelenv: developmentin all namespaces.

asked 08/11/2024
Stergios Gaidatzis
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first