Recall & Review
beginner
What is a label in Kubernetes?
A label is a key-value pair attached to Kubernetes objects like pods. It helps identify and organize resources for selection and routing.
Click to reveal answer
beginner
How do labels help with service routing in Kubernetes?
Labels allow services to select and route traffic only to pods with matching labels, enabling targeted communication between components.
Click to reveal answer
beginner
What is a selector in a Kubernetes Service?
A selector is a query that matches pods with specific labels. The service routes traffic to all pods matching this selector.
Click to reveal answer
beginner
Example: How to label a pod with app=frontend?
In the pod YAML, under metadata, add: <br>
labels:<br> app: frontendClick to reveal answer
beginner
How does a Kubernetes Service use labels to route traffic?
The service uses a selector to find pods with matching labels and sends network requests only to those pods.
Click to reveal answer
What does a Kubernetes Service selector do?
✗ Incorrect
A selector matches pods with labels so the service knows where to send traffic.
Which of these is a valid label format?
✗ Incorrect
Labels use key:value format in YAML, like app: frontend.
If a service selector is 'app=backend', which pods receive traffic?
✗ Incorrect
Only pods with the label app=backend get traffic from that service.
Can a pod have multiple labels?
✗ Incorrect
Pods can have many labels to describe different attributes.
What happens if no pods match a service selector?
✗ Incorrect
If no pods match, the service has no endpoints and cannot route traffic.
Explain how labels and selectors work together to route traffic in Kubernetes services.
Think about how a service finds the right pods to send requests.
You got /4 concepts.
Describe how you would label a pod and create a service to route traffic to it.
Consider the YAML structure for both pod and service.
You got /3 concepts.