Challenge - 5 Problems
Label Filtering Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Filter pods by label with kubectl
You have several pods with labels:
app=web and env=prod. Which command lists only pods with label app=web?Attempts:
2 left
💡 Hint
Use the
-l or --selector flag to filter by label.✗ Incorrect
The
-l flag filters pods by label. Option C correctly filters pods with label app=web. Option C uses an invalid flag. Option C filters by a different label. Option C filters by a label that does not exist.💻 Command Output
intermediate2:00remaining
Filter pods with multiple labels
Which command lists pods with labels
app=web AND env=prod?Attempts:
2 left
💡 Hint
Use commas to combine multiple labels in the selector.
✗ Incorrect
Option A correctly uses commas to combine labels for AND filtering. Options B and C have invalid syntax. Option A uses a semicolon which is invalid.
❓ Troubleshoot
advanced2:00remaining
Why does this label filter return no pods?
You run
kubectl get pods -l app=web env=prod but get no pods listed. Why?Attempts:
2 left
💡 Hint
Check the label selector syntax carefully.
✗ Incorrect
The command incorrectly separates labels with a space instead of a comma. The correct syntax is
-l app=web,env=prod. Options A, C, and D may be possible but the question focuses on syntax error.🧠 Conceptual
advanced2:00remaining
Label selector operators in kubectl
Which label selector operator filters pods that have label
env but its value is NOT prod?Attempts:
2 left
💡 Hint
Use the != operator to exclude a specific label value.
✗ Incorrect
Option A uses the != operator to select pods where
env label is not prod. Option A uses notin which requires parentheses and is valid but the question asks for the operator that filters pods with label env but value not prod using simple syntax. Option A selects only prod. Option A selects only prod.✅ Best Practice
expert2:00remaining
Efficiently watch pods with label changes
You want to watch pods with label
app=web and get notified immediately when pods are added or removed. Which command is best?Attempts:
2 left
💡 Hint
Use the watch flag to continuously monitor resource changes.
✗ Incorrect
Option D uses
--watch to continuously show pod changes matching the label. Option D only shows current details once. Option D is invalid flag. Option D follows logs from matching pods but does not watch for pods being added or removed.