0
0
Kubernetesdevops~20 mins

Organizing with recommended labels in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Label Mastery in Kubernetes
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Purpose of the 'app.kubernetes.io/name' label
What is the main purpose of using the app.kubernetes.io/name label in Kubernetes resource manifests?
ATo uniquely identify the name of the application across resources
BTo specify the version of the application deployed
CTo indicate the environment like production or staging
DTo define the owner or team responsible for the resource
Attempts:
2 left
💡 Hint
Think about how you would find all resources belonging to the same application.
💻 Command Output
intermediate
1:30remaining
Output of label selector command
Given the following Kubernetes pods with labels:

pod1: app.kubernetes.io/name=frontend, app.kubernetes.io/version=1.0
pod2: app.kubernetes.io/name=backend, app.kubernetes.io/version=1.0
pod3: app.kubernetes.io/name=frontend, app.kubernetes.io/version=2.0

What is the output of the command kubectl get pods -l app.kubernetes.io/name=frontend?
AOnly pod3 is listed
Bpod1, pod2, and pod3 are listed
COnly pod1 is listed
Dpod1 and pod3 are listed
Attempts:
2 left
💡 Hint
The label selector matches all pods with the specified label key and value.
Configuration
advanced
2:00remaining
Correct label usage in Deployment manifest
Which option shows the correct way to add recommended labels to a Kubernetes Deployment manifest for an app named myapp version v2 owned by team devops?
A
metadata:
  labels:
    app.kubernetes.io/name: myapp
    app.kubernetes.io/version: v2
    app.kubernetes.io/managed-by: devops
B
metadata:
  labels:
    app.kubernetes.io/name: myapp
    app.kubernetes.io/version: v2
    app.kubernetes.io/part-of: devops
C
metadata:
  labels:
    app.kubernetes.io/name: myapp
    app.kubernetes.io/version: v2
    app.kubernetes.io/created-by: devops
D
metadata:
  labels:
    app.kubernetes.io/name: myapp
    app.kubernetes.io/version: v2
    app.kubernetes.io/owner: devops
Attempts:
2 left
💡 Hint
Check the official recommended labels for grouping and ownership.
Troubleshoot
advanced
2:00remaining
Why does label selector fail to find pods?
You run kubectl get pods -l app.kubernetes.io/part-of=frontend but no pods are returned. You know pods exist with label app.kubernetes.io/part-of: frontend. What is the most likely cause?
AThe label value in pods is uppercase <code>Frontend</code> instead of lowercase <code>frontend</code>
BThe pods do not have the label <code>app.kubernetes.io/part-of</code>
CThe pods are in a different namespace than the current kubectl context
DThe label key is misspelled in the selector
Attempts:
2 left
💡 Hint
Label selectors only find resources in the current namespace by default.
Best Practice
expert
2:00remaining
Recommended label for tracking deployment instance
Which recommended Kubernetes label should you use to uniquely identify a specific deployment or release instance of an application?
Aapp.kubernetes.io/instance
Bapp.kubernetes.io/component
Capp.kubernetes.io/managed-by
Dapp.kubernetes.io/version
Attempts:
2 left
💡 Hint
This label helps distinguish different deployments of the same app version.