0
0
Kubernetesdevops~10 mins

Why labels organize resources in Kubernetes - Test Your Understanding

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

Complete the code to add a label to a Kubernetes pod.

Kubernetes
kubectl label pods my-pod environment=production [1]
Drag options to blanks, or click blank then click option'
A--overwrite
B--selector
C--all
D--dry-run
Attempts:
3 left
💡 Hint
Common Mistakes
Using --selector instead of --overwrite
Forgetting to add the flag causes error if label exists
2fill in blank
medium

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

Kubernetes
kubectl get pods -l [1]
Drag options to blanks, or click blank then click option'
Atier=database
Bapp=backend
Capp=frontend
Denvironment=production
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong label key or value
Omitting the -l flag
3fill in blank
hard

Fix the error in the command to delete pods with label tier=backend.

Kubernetes
kubectl delete pods -l [1]
Drag options to blanks, or click blank then click option'
Atier=frontend
Btier=backend
Capp=backend
Denvironment=staging
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong label value
Deleting pods without label filter
4fill in blank
hard

Fill both blanks to create a label selector for pods with app=web and environment=prod.

Kubernetes
kubectl get pods -l [1],[2]
Drag options to blanks, or click blank then click option'
Aapp=web
Bapp=api
Cenvironment=prod
Denvironment=dev
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong label keys or values
Adding spaces after commas
5fill in blank
hard

Fill all three blanks to create a dictionary of labels in a pod YAML manifest.

Kubernetes
metadata:
  labels:
    [1]: [2]
    [3]: production
Drag options to blanks, or click blank then click option'
Aapp
Bfrontend
Cenvironment
Dbackend
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping keys and values
Using incorrect label names