0
0
Kubernetesdevops~10 mins

Label-based filtering with kubectl in Kubernetes - Interactive Code Practice

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

Complete the command to list pods with the label app=nginx.

Kubernetes
kubectl get pods -l [1]
Drag options to blanks, or click blank then click option'
Aapp=nginx
Bapp-nginx
Capp_nginx
Dapp:nginx
Attempts:
3 left
💡 Hint
Common Mistakes
Using dashes or colons instead of equal sign in label selector.
Missing the -l flag before the label selector.
2fill in blank
medium

Complete the command to list services with the label tier=backend.

Kubernetes
kubectl get services --selector=[1]
Drag options to blanks, or click blank then click option'
Atier:backend
Btier-backend
Ctier=backend
Dtier_backend
Attempts:
3 left
💡 Hint
Common Mistakes
Using dashes or underscores instead of equal sign.
Forgetting to use the --selector flag.
3fill in blank
hard

Fix the error in the command to list pods with label environment=prod.

Kubernetes
kubectl get pods -l [1]
Drag options to blanks, or click blank then click option'
Aenvironment=prod
Benvironment-prod
Cenvironment:prod
Denvironment_prod
Attempts:
3 left
💡 Hint
Common Mistakes
Using dash or colon instead of equal sign.
Missing the -l flag.
4fill in blank
hard

Fill both blanks to list pods with label app=web and tier=frontend.

Kubernetes
kubectl get pods -l [1],[2]
Drag options to blanks, or click blank then click option'
Aapp=web
Bapp-web
Ctier=frontend
Dtier-frontend
Attempts:
3 left
💡 Hint
Common Mistakes
Using dashes instead of equal signs.
Separating labels with spaces instead of commas.
5fill in blank
hard

Fill all three blanks to list pods with label app=api, environment=staging, and version=v1.

Kubernetes
kubectl get pods -l [1],[2],[3]
Drag options to blanks, or click blank then click option'
Aapp=api
Benvironment=staging
Cversion=v1
Dversion-v1
Attempts:
3 left
💡 Hint
Common Mistakes
Using dashes instead of equal signs.
Missing commas between labels.