0
0
Kubernetesdevops~5 mins

Service selectors and labels in Kubernetes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a label in Kubernetes?
A label is a key-value pair attached to Kubernetes objects like pods. It helps organize and select groups of objects.
Click to reveal answer
beginner
What does a service selector do in Kubernetes?
A service selector matches labels on pods to route network traffic to those pods.
Click to reveal answer
intermediate
How do labels and selectors work together in a Kubernetes Service?
Labels identify pods, and selectors in the service find pods with matching labels to send traffic to them.
Click to reveal answer
beginner
Can a service selector match multiple pods?
Yes, a service selector can match many pods if they share the same label key-value pairs.
Click to reveal answer
intermediate
What happens if a service selector does not match any pods?
The service will have no endpoints and will not route traffic to any pods.
Click to reveal answer
What is the purpose of labels in Kubernetes?
ATo organize and select objects
BTo store pod logs
CTo define network policies
DTo set resource limits
What does a service selector use to find pods?
APod names
BPod IP addresses
CNode names
DLabels on pods
If a service selector matches multiple pods, what happens?
ATraffic is load balanced across those pods
BOnly the first pod receives traffic
CTraffic is sent to the node instead
DThe service fails to start
What is a key difference between labels and annotations?
AAnnotations select pods; labels do not
BLabels are for selection; annotations are for metadata
CLabels are only for nodes
DAnnotations control network traffic
What happens if no pods match a service selector?
AThe service routes traffic to all pods
BThe service crashes
CThe service has no endpoints and no traffic is routed
DThe service creates new pods automatically
Explain how Kubernetes uses labels and selectors to route traffic to pods.
Think about how a service finds the right pods to send requests.
You got /3 concepts.
    Describe what happens when a service selector does not match any pods in Kubernetes.
    Consider the service's ability to send traffic without matching pods.
    You got /3 concepts.