0
0
Kubernetesdevops~10 mins

Label selectors (equality, set-based) in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select pods with label app equal to nginx.

Kubernetes
kubectl get pods -l app[1]nginx
Drag options to blanks, or click blank then click option'
A=
Bin
C!=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '=' causes syntax error.
Using '!=' selects pods without the label value.
Using 'in' requires a set, not a single value.
2fill in blank
medium

Complete the code to select pods where environment label is not production.

Kubernetes
kubectl get pods -l environment[1]production
Drag options to blanks, or click blank then click option'
A=
B!=
Cin
Dnotin
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' selects pods with the label value equal to production.
Using 'in' or 'notin' requires set syntax with parentheses.
3fill in blank
hard

Fix the error in the label selector to select pods with tier either frontend or backend.

Kubernetes
kubectl get pods -l tier [1] (frontend,backend)
Drag options to blanks, or click blank then click option'
Anotin
B=
C!=
Din
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' with parentheses causes syntax error.
Using '!=' or 'notin' selects pods outside the set.
4fill in blank
hard

Complete the code to select pods with role label not in dev or test.

Kubernetes
kubectl get pods -l role [1] (dev,test) 
Drag options to blanks, or click blank then click option'
Anotin
Bin
C--selector
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'in' selects pods inside the set, opposite of what is needed.
Adding extra flags after the selector causes errors.
5fill in blank
hard

Fill both blanks to select pods with label env equal to prod and tier in frontend or backend.

Kubernetes
kubectl get pods -l env[1]prod, tier [2] (frontend,backend)
Drag options to blanks, or click blank then click option'
A=
Bin
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '=' for equality.
Adding extra characters after the selector.
Using 'notin' instead of 'in' for tier.