Skip to content

Commit be05551

Browse files
committed
KEP-1287: Edge-triggered resizes
1 parent 45ec205 commit be05551

File tree

1 file changed

+25
-2
lines changed
  • keps/sig-node/1287-in-place-update-pod-resources

1 file changed

+25
-2
lines changed

keps/sig-node/1287-in-place-update-pod-resources/README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ tell whether the resize status includes the latest resize request.
338338
As of Kubernetes v1.20, the CRI has included support for in-place resizing of containers via the
339339
`UpdateContainerResources` API, which is implemented by both containerd and CRI-O. Additionally, the
340340
`ContainerStatus` message includes a `ContainerResources` field, which reports the current resource
341-
configuration of the container.
341+
configuration of the container. `UpdateContainerResources` should be idempotent, if called with the
342+
same configuration multiple times.
342343

343344
Starting with Kubernetes v1.33, the contract on the `UpdateContainerResources` call will be updated
344345
to specify that runtimes should not deliberately restart the container to adjust the resources. If a
@@ -427,7 +428,7 @@ being resized, it adds the new desired resources (i.e
427428
Spec.Containers[i].Resources.Requests) to the sum.
428429

429430
* If new desired resources fit, Kubelet accepts the resize, updates
430-
the allocated resourcesa, and sets Status.Resize to
431+
the allocated resources, and sets Status.Resize to
431432
"InProgress". It then invokes the UpdateContainerResources CRI API to update
432433
Container resource limits. Once all Containers are successfully updated, it
433434
updates Status...Resources to reflect new resource values and unsets
@@ -710,6 +711,28 @@ intended.
710711

711712
The atomic resize requirement should be reevaluated prior to GA, and in the context of pod-level resources.
712713

714+
### Edge-triggered Resizes
715+
716+
The resources specified by the Kubelet are not guaranteed to be the actual resources configured for
717+
a pod or container. Examples include:
718+
- Linux kernel enforced minimums for CPU shares & quota
719+
- Systemd cgroup driver rounds CPU quota up to the nearest 10ms
720+
- NRI plugins can change resource configuration
721+
722+
Therefore the Kubelet cannot reliably compare desired & actual resources to know whether to trigger
723+
a resize (a level-triggered approach).
724+
725+
To accommodate this, the Kubelet stores a bit along with every resource in the allocated resource
726+
checkpoint which tracks whether the resource has been successfully resized. For container resources,
727+
this means the `UpdateContainerResources` request succeeded. This status bit is persisted in the
728+
allocated resources checkpoint to avoid extra resize requests across Kubelet restarts. There is the
729+
possibility that a poorly timed restart could lead to a resize request being repeated, so
730+
`UpdateContainerResources` should be idempotent.
731+
732+
When a resize request succeeds, the pod will be marked for resync to read the latest resources. If
733+
the actual configured resources do not match the desired resources, this will be reflected in the
734+
pod status resources.
735+
713736
### Memory Limit Decreases
714737

715738
Setting the memory limit below current memory usage can cause problems. With cgroups v1 the change

0 commit comments

Comments
 (0)