0
0
Kubernetesdevops~10 mins

Adding labels to resources 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 add a label to a pod named 'my-pod'.

Kubernetes
kubectl label pods my-pod [1] env=production
Drag options to blanks, or click blank then click option'
A--set
B--label
C--add
D--overwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using --set instead of --overwrite
Using --add which is not a valid flag
Using --label which is incorrect syntax
2fill in blank
medium

Complete the YAML snippet to add a label 'app: web' to a deployment.

Kubernetes
metadata:
  labels:
    [1]: web
Drag options to blanks, or click blank then click option'
Aapp
Bversion
Ctier
Denv
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'version' or 'env' which are different label keys
Using 'tier' which is unrelated here
3fill in blank
hard

Fix the error in the command to label a node named 'node1' with 'role=worker'.

Kubernetes
kubectl label nodes node1 [1] role=worker
Drag options to blanks, or click blank then click option'
A--replace
B--force
C--overwrite
D--update
Attempts:
3 left
💡 Hint
Common Mistakes
Using --force which is not a valid flag for labeling
Using --replace or --update which do not exist
4fill in blank
hard

Fill both blanks to add label 'env=prod' to a service named 'backend'.

Kubernetes
kubectl label service backend [1] [2]
Drag options to blanks, or click blank then click option'
Aenv=prod
Bteam=devops
C--overwrite
D--force
Attempts:
3 left
💡 Hint
Common Mistakes
Not using --overwrite flag
Using --force which is invalid
Swapping the order of flag and label
5fill in blank
hard

Fill all three blanks to create a pod YAML with labels 'app: frontend' and 'env: staging'.

Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  labels:
    [1]: [2]
    [3]: staging
Drag options to blanks, or click blank then click option'
Aapp
Bfrontend
Cenv
Dproduction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'production' instead of 'staging'
Mixing keys and values in wrong order