Recall & Review
beginner
What is pod affinity in Kubernetes?
Pod affinity lets you tell Kubernetes to schedule pods close to other pods based on labels. It helps pods run together on the same or nearby nodes.
Click to reveal answer
beginner
What does pod anti-affinity do?
Pod anti-affinity tells Kubernetes to avoid placing pods near certain other pods. It helps spread pods apart for better availability.
Click to reveal answer
intermediate
Which Kubernetes field is used to specify pod affinity rules in a pod spec?
The field is
affinity.podAffinity inside the pod spec's spec.affinity section.Click to reveal answer
intermediate
How do you express that a pod should not be scheduled on the same node as pods with label
app=frontend?Use pod anti-affinity with a rule matching label
app=frontend and set topologyKey to kubernetes.io/hostname to avoid the same node.Click to reveal answer
advanced
What is the difference between
requiredDuringSchedulingIgnoredDuringExecution and preferredDuringSchedulingIgnoredDuringExecution in pod affinity?requiredDuringSchedulingIgnoredDuringExecution means the rule must be met to schedule the pod. preferredDuringSchedulingIgnoredDuringExecution means the rule is a soft preference but not mandatory.Click to reveal answer
What does pod affinity help you do?
✗ Incorrect
Pod affinity helps schedule pods near other pods that match certain labels.
Which field defines pod anti-affinity rules?
✗ Incorrect
Pod anti-affinity rules are set under spec.affinity.podAntiAffinity.
What does setting
topologyKey: kubernetes.io/hostname in pod anti-affinity do?✗ Incorrect
This key means pods should not be scheduled on the same node (hostname).
Which affinity type is a soft preference, not mandatory?
✗ Incorrect
Preferred affinity is a soft rule, while required affinity is mandatory.
Pod anti-affinity is useful to:
✗ Incorrect
Anti-affinity helps spread pods to avoid single points of failure.
Explain how pod affinity and anti-affinity affect pod scheduling in Kubernetes.
Think about how pods can be grouped or separated on nodes.
You got /4 concepts.
Describe the difference between required and preferred rules in pod affinity or anti-affinity.
Consider how strict Kubernetes is when placing pods.
You got /3 concepts.