Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
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
✗ Incorrect
The --overwrite flag allows updating an existing label on the resource.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'version' or 'env' which are different label keys
Using 'tier' which is unrelated here
✗ Incorrect
The label key app is commonly used to identify the application name.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using --force which is not a valid flag for labeling
Using --replace or --update which do not exist
✗ Incorrect
The --overwrite flag is required to change an existing label on a node.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using --overwrite flag
Using --force which is invalid
Swapping the order of flag and label
✗ Incorrect
The --overwrite flag allows updating existing labels. Then the label env=prod is added.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'production' instead of 'staging'
Mixing keys and values in wrong order
✗ Incorrect
The labels are key-value pairs. Here, app: frontend and env: staging are set.