0
0
Kubernetesdevops~10 mins

Using labels for service routing 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 the label app=frontend.

Kubernetes
selector:
  matchLabels:
    app: [1]
Drag options to blanks, or click blank then click option'
Acache
Bbackend
Cdatabase
Dfrontend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'backend' or other labels instead of 'frontend'.
2fill in blank
medium

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

Kubernetes
selector:
  tier: [1]
Drag options to blanks, or click blank then click option'
Abackend
Bdatabase
Ccache
Dfrontend
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'frontend' with 'backend' label values.
3fill in blank
hard

Fix the error in the selector to correctly route to pods with label env=production.

Kubernetes
selector:
  env: [1]
Drag options to blanks, or click blank then click option'
Astaging
Bproduction
Cdevelopment
Dtest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'staging' or other environment labels by mistake.
4fill in blank
hard

Fill both blanks to route traffic to pods with labels app=api and version=v2.

Kubernetes
selector:
  app: [1]
  version: [2]
Drag options to blanks, or click blank then click option'
Aapi
Bv1
Cv2
Dweb
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing version values or app labels incorrectly.
5fill in blank
hard

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

Kubernetes
selector:
  role: [1]
  env: [2]
  track: [3]
Drag options to blanks, or click blank then click option'
Afrontend
Bprod
Cstable
Ddev
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'dev' instead of 'prod' or mixing labels.