πŸ”— Prerequisite: Chapter 01 (Pods, resources, QoS) β€” βœ… you’ve mastered it!


Phase 1: Basic Node Selection (Simple & Explicit)

Start with the most straightforward way to control where a Pod runs.

  1. pod-for-specific-node.yml

    β†’ Schedule Pod on a specific node by name using spec.nodeName.

    β†’ Hard assignment (bypasses scheduler). Rarely used β€” good for learning.

  2. pod-for-specific-node-selector.yml

    β†’ Use nodeSelector to schedule on nodes with matching labels.

    β†’ Simple, widely used, great for zonal placement (e.g., disktype: ssd).


Phase 2: Node Affinity (Flexible & Expressive)

Modern, powerful replacement for nodeSelector β€” supports required and preferred rules.

  1. pod-with-required-node-affinity.yml

    β†’ Must run on nodes matching affinity rules (requiredDuringScheduling...).

  2. pod-with-preferred-node-affinity.yml

    β†’ Prefer certain nodes, but run elsewhere if needed (preferredDuringScheduling...).

  3. pod-with-node-affinity-multiple.yml

    β†’ Combine multiple affinity rules (e.g., match zone AND GPU).

  4. pod-with-node-affinity-cannot.yml

    β†’ Example where no node matches β†’ Pod stays Pending (great for troubleshooting).

πŸ’‘ Key Concept:


Phase 3: Pod Affinity & Anti-Affinity (Pod-to-Pod Rules)

Control placement based on other Pods β€” critical for HA and isolation.

  1. pod-with-anti-pod-affinity.yml

    β†’ Avoid running on same node/zone as other Pods (e.g., spread replicas).

  2. pod-for-anti-affinity.yml

    β†’ Likely a companion Pod used to demonstrate anti-affinity (e.g., deploy two Pods that must be separated).

🎯 Use Cases: