How does the scheduler decide where a pod runs, and how do you influence it with affinity and taints?
What they are really testing: Whether you know the filter-then-score model and the difference between attracting pods (affinity) and repelling them (taints). Misusing these causes unschedulable pods.
A real interview question
How does the scheduler decide where a pod runs, and how do you influence it with affinity and taints?
What most people say
drag me
“The scheduler puts the pod on a node that has enough resources.”
Resource fit is only the first filter. It misses affinity, taints/tolerations, and spreading, which are the actual tools for controlling placement and the source of "why is my pod Pending".
The follow-ups they ask next
A pod is stuck in Pending. What scheduling causes do you check?
No node with enough free CPU/memory for the requests, an unsatisfied nodeSelector/affinity, a taint with no matching toleration, or no node in the required zone. kubectl describe pod shows the scheduler reason.
What is the difference between node affinity and a taint?
Affinity is the pod choosing nodes (attraction). A taint is the node repelling pods unless they tolerate it (rejection). You often combine them: taint a node pool and give the intended pods both a toleration and affinity for it.
What the interviewer is listening for
- Knows filter-then-score
- Distinguishes affinity (attract) from taints (repel)
- Uses spread/anti-affinity for resilience
What sinks the answer
- Only "enough resources"
- Confuses affinity and taints
- No idea why a pod is Pending
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“The scheduler [filters nodes that cannot run the pod (resources, selectors, taints), then scores and picks the best]. Affinity [attracts: nodeSelector/node affinity, plus pod affinity/anti-affinity to co-locate or spread]. Taints [repel pods unless they tolerate, to reserve nodes]. For resilience [spread replicas across nodes/zones]. Most Pending pods [fail one of these filters].”
Keep going with kubernetes
Foundation
What problem does Kubernetes solve, and what does it actually do for you?
Foundation
What are the main components of a Kubernetes cluster (control plane and nodes)?
Foundation
What is a Pod, and why do you use a Deployment instead of creating Pods directly?
Foundation
What is a Service in Kubernetes, and what are the main types?
Junior
When would you use a Deployment versus a StatefulSet versus a DaemonSet?
Junior
How do you inject configuration and secrets into a pod, and what is the catch with Kubernetes Secrets?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free