Mastering Kubernetes v1.37: Scheduler Preemption for In-Place Pod Resize
In Kubernetes, managing resources efficiently is crucial, especially as workloads scale. The new scheduler preemption for in-place pod resize feature addresses a common pain point: when nodes are fully utilized, critical pods may not be able to resize due to lack of available resources. By allowing the scheduler to preempt lower-priority workloads, Kubernetes ensures that essential applications can adapt dynamically to changing demands.
This feature integrates directly into the kube-scheduler's core scheduling cycle. When a pod requests an in-place resize and is marked with a Deferred status, the kube-scheduler actively monitors these pods. It identifies lower-priority 'victim' pods on the same node and initiates their graceful eviction, effectively freeing up the necessary capacity. To enable this feature, you must set the InPlacePodVerticalScalingSchedulerPreemption feature gate to true in your cluster configuration. Additionally, you can control preemption behavior on specific nodes using the spec.podPreemptionPolicy field.
In production, ensure your cluster is running Kubernetes v1.37 or later, and that all control plane components have the feature gate enabled. Be cautious with the node images you use; they must correspond to Kubernetes v1.37 or later. This feature is still in alpha, so expect potential instability and be prepared for edge cases where preemption may not behave as expected.
Key takeaways
- →Enable the InPlacePodVerticalScalingSchedulerPreemption feature gate to allow preemption for critical workloads.
- →Monitor pods with a Deferred resize status to manage resource allocation effectively.
- →Use the spec.podPreemptionPolicy to customize preemption behavior on specific nodes.
Why it matters
This feature significantly enhances resource management, allowing critical applications to scale even under heavy load. It helps prevent downtime and improves overall application reliability in production environments.
Code examples
# kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
featureGates:
InPlacePodVerticalScalingSchedulerPreemption: truekind create cluster --config kind-config.yaml --image kindest/node:v1.37.0kubectl get nodes -o custom-columns=NAME:.metadata.name,ALLOCATABLE_CPU:.status.allocatable.cpuWhen NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsIndustry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKA — the gold standard Kubernetes administrator cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.
Get CKA certified →Kubernetes v1.37: Mastering Node Lifecycle Conditions
Kubernetes v1.37 introduces Node lifecycle conditions to help manage node states more effectively. These conditions allow you to communicate maintenance and drain statuses clearly. Understanding how to leverage this feature can streamline your cluster operations.
Mastering Workload-Aware Scheduling in Kubernetes v1.37
Kubernetes v1.37 introduces significant advancements in workload-aware scheduling, crucial for optimizing resource allocation. The new CompositePodGroup API allows for complex scheduling scenarios that can enhance application performance in production environments.
Unlocking Kubernetes v1.37: DRA Updates You Need to Know
Kubernetes v1.37 introduces significant updates to Device Resource Allocation (DRA) that streamline resource management. With DRA Extended Resource support, you can now satisfy resource requests without needing separate device plugins. This change simplifies your configuration and enhances scheduling efficiency.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.