In-Place Pod Resource Resize: Adjust CPU and Memory Without Restarts
Briefly

"Application is running smooth and a sudden traffic spike arises creating an urgent need to adjust CPU and memory resources. The solution? Vertical Pod Autoscaler (VPA) springs into action - but it has to recreate every pod to apply the changes. The result: connection drops, service interruptions, and frustrated users. For years, Kubernetes developers have dealt with a frustrating limitation: adjusting pod resources meant destroying and recreating pods."
"For stateful workloads its even more painful and that changes with K8s 1.35 . In-Place Pod Resource Resize (now GA/stable) - allows CPU and memory adjustments without pod recreation Let's write some code to see the first feature i.e. In-Place Pod Resource Resize minikube start --kubernetes-version=v1.35.0 apiVersion: v1kind: Podmetadata: name: resize-demospec: containers: - name: web-container image: nginx resources: requests: cpu: "200m" memory: "256Mi" limits: cpu: "500m" memory: "512Mi" resizePolicy: - resourceName: "cpu" restartPolicy: "NotRequired" - resourceName: "memory" restartPolicy: "NotRequired" kubectl apply -f resize-demo.yaml"
Kubernetes historically required recreating pods to change CPU and memory settings, causing connection drops and service interruptions during scaling events. Vertical Pod Autoscaler (VPA) previously triggered pod recreation to apply new resource allocations. Kubernetes 1.35 introduces GA In-Place Pod Resource Resize, enabling CPU and memory adjustments without recreating pods. This feature reduces downtime and improves handling of traffic spikes, especially for stateful workloads. Example configuration shows a Pod manifest with resources defined, resizePolicy entries for cpu and memory with restartPolicy 'NotRequired'. Minikube v1.35.0 can be used to test the feature locally by applying the manifest.
Read at Medium
Unable to calculate read time
[
|
]