DRAFT This is not a complete article. I haven’t yet fully tested and vetted the steps I built. I will come back and hopefully update.
In Kubernetes v1.33, In-Place Pod Resize has entered Beta. This feature allows you to resize the CPU and memory resources of containers in a running Pod without needing to restart them. This feature is fairly nice for Power customers who scale their systems vertically. You would need to also restart the kubelet.
One no longer has to change the resource requests or limits of a pod in Kubernetes and restart the Pod. This restart was disruptive for long-running workloads.
With in-place pod resize, autoscaling workloads, improving stateful applications is a real win.
- Enable the
InPlacePodVerticalScalingfeaturegate in akindconfig calledkind-cluster-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
featureGates:
InPlacePodVerticalScaling: true
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
apiServer:
extraArgs:
v: "1"
scheduler:
extraArgs:
v: "1"
controllerManager:
extraArgs:
v: "1"
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "1"
- role: worker
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "1"
- Download
kind
mkdir -p dev-cache
GOBIN=$(PWD)/dev-cache/ go install sigs.k8s.io/kind@v0.29.0
- Start the
kindcluster
KIND_EXPERIMENTAL_PROVIDER=podman dev-cache/kind create cluster \
--image quay.io/powercloud/kind-node:v1.33.1 \
--name test \
--config kind-cluster-config.yaml\
--wait 5m
- Create a namespace
apiVersion: v1
kind: Namespace
metadata:
labels:
kubernetes.io/metadata.name: resize-test
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/audit-version: v1.24
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/warn-version: v1.24
name: resize-test
- Create a Pod
apiVersion: v1
kind: Pod
metadata:
name: resize-test
spec:
containers:
- name: resize-test
image: registry.access.redhat.com/ubi9/ubi
resizePolicy:
- resourceName: cpu
restartPolicy: NotRequired
- resourceName: memory
restartPolicy: NotRequired
resources:
limits:
memory: "200Mi"
cpu: "1"
requests:
memory: "200Mi"
cpu: "1"
- Edit
kubectl edit pod/test -n resize-test - Check
kubectl describe pod/test -n resize-test - Check
oc rsh pod/testand runlscputo see the size changed
You’ve seen how this feature functions with Kubernetes and can resize your Pod without a restart.
