Ch. 14 · Kubernetes

Kubernetes Affinity, Taints and Scheduling Intent

Kubernetes Affinity, Taints and Scheduling Intent. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readadvancedupdated Oct 3, 2026

Affinity selects or prefers placement; taints repel Pods unless tolerated. A toleration permits placement but does not force it.

Before you start

You should understand Pods, Deployments and Services. Read desired configuration separately from observed cluster state. Use a development cluster when trying changes, and inspect events and status rather than assuming that an accepted manifest means the workload is ready to serve traffic.

The practical goal is to reason through this situation: A specialized workload tolerates a dedicated node taint and also selects the intended node group. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Separate permission and selection

A toleration allows a tainted node but does not force placement there.

Step 2: Apply required selection

Use appropriate affinity or selectors for mandatory node characteristics.

Step 3: Check available capacity

Strict placement reduces the set of nodes available for rollout and recovery.

Worked scenario

A specialized workload tolerates a dedicated node taint and also selects the intended node group.

A GPU workload tolerates the dedicated-node taint but can still land on an ordinary node unless another requirement selects GPU nodes. With strict selection added, insufficient dedicated capacity can leave it pending. Preferences and requirements have different tradeoffs; specify which the application actually needs.

Common mistake

A toleration alone can allow scheduling on ordinary nodes too.

Verify the behavior

Test eligible and ineligible nodes plus lack of capacity.

Interview exercise

Guarantee a placement requirement.

Answer and reasoning

Use the appropriate required selection rule, then ensure enough eligible capacity exists for rollout and failure.

Continue learning

Compare the scenario with the Kubernetes interview questions and test your understanding with the Kubernetes MCQs. For terminology and implementation details, consult the reference material.

More in Kubernetes

read ✓Kubernetes · mid

Kubernetes ConfigMap Update Behavior

Understand why ConfigMap changes reach volumes but not environment variables, and how to roll a Deployment deliberately.

~2 min readread →
read ✓Kubernetes · mid

Kubernetes emptyDir Volumes

Share scratch space between containers in a pod with emptyDir, choose the backing medium, and bound its size.

~2 min readread →
read ✓Kubernetes · hard

Kubernetes Gateway API for Ingress

Route traffic with GatewayClass, Gateway and HTTPRoute, and understand how the Gateway API improves on Ingress.

~2 min readread →
esc