0
0
Kubernetesdevops~10 mins

Service selectors and labels in Kubernetes - Interactive Code Practice

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

Complete the code to select pods with label app=web.

Kubernetes
selector:
  matchLabels:
    app: [1]
Drag options to blanks, or click blank then click option'
Aweb
Bdatabase
Ccache
Dfrontend
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong label value like 'database' or 'cache'.
Confusing the label key with the value.
2fill in blank
medium

Complete the service selector to match pods with label tier=backend.

Kubernetes
selector:
  matchLabels:
    tier: [1]
Drag options to blanks, or click blank then click option'
Afrontend
Bdatabase
Ccache
Dbackend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'frontend' instead of 'backend'.
Mixing up label keys and values.
3fill in blank
hard

Fix the error in the selector to correctly match pods with label env=prod.

Kubernetes
selector:
  matchLabels:
    env: [1]
Drag options to blanks, or click blank then click option'
Aproduction
Bprod
Cdevelopment
Dtest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'production' instead of 'prod'.
Using unrelated label values like 'test' or 'development'.
4fill in blank
hard

Fill both blanks to select pods with labels app=api and version=v1.

Kubernetes
selector:
  matchLabels:
    app: [1]
    version: [2]
Drag options to blanks, or click blank then click option'
Aapi
Bv2
Cv1
Dweb
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing version values like using 'v2' instead of 'v1'.
Using wrong app label like 'web' instead of 'api'.
5fill in blank
hard

Fill all three blanks to create a selector for pods with labels role=frontend, env=staging, and track=canary.

Kubernetes
selector:
  matchLabels:
    role: [1]
    env: [2]
    track: [3]
Drag options to blanks, or click blank then click option'
Afrontend
Bstaging
Ccanary
Dproduction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'production' instead of 'staging' for env.
Mixing up the label values for role or track.