Member-only story

Kubernetes Scheduling Policies

Luca Berton
4 min readOct 30, 2024

In Kubernetes, Scheduling Policies define how Pods are placed on Nodes, enabling administrators to have fine-grained control over the cluster’s resource utilization, workload distribution, and compliance with scheduling rules. By configuring Scheduling Policies, you can influence how Pods are assigned to Nodes based on resource needs, affinity/anti-affinity, taints, tolerations, and other factors.

Here’s a breakdown of some key scheduling policies and how they can be applied in Kubernetes.

Section 1: Node Affinity and Anti-Affinity

Node Affinity

Node Affinity is a rule that ensures Pods are scheduled on specific Nodes based on labels.

  • RequiredDuringSchedulingIgnoredDuringExecution: Pods must be scheduled on Nodes that meet the affinity rules. If no such Node is available, scheduling fails.
  • PreferredDuringSchedulingIgnoredDuringExecution: Pods prefer Nodes that meet the affinity rules, but if no such Node is available, they can still be scheduled on other Nodes.

Example: Node Affinity

apiVersion: v1
kind: Pod
metadata:
name: node-affinity-example
spec:
containers:
- name: nginx
image: nginx
affinity:
nodeAffinity…

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet