Skip to content

VPA InPlaceOrRecreate doc update with InPlacePodResize 1.34 #8805

@maxcao13

Description

@maxcao13

I think some parts of our existing docs are not correct anymore with 1.34.

https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/docs/features.md#in-place-updates-inplaceorrecreate

In particular, the part where it mentions that we will fall back to pod recreation if we do limit downscaling on a container with NotRequired (previously renamed to PreferNoRestart but got reverted) resize policy. I think previously this was in the KEP docs:

In the initial beta release of in-place resize, we will disallow `PreferNoRestart` memory limit decreases, enforced through API validation. The intent is for this restriction to be relaxed in the future, but the design of how limit decreases will be approached is still undecided.

I don't exactly remember how we handled this, but if the API validation triggered an API error, then the VPA probably returned that error and then indeed fell back to Recreate.

But now in 1.34, memory limit decrease is best-effort, but can trigger an OOMkill on the container. So there are now 3 scenarios with in place pod resize:

  1. It is possible that nothing goes wrong with a memory limit decrease, and that the kubelet is okay with the change, and everything is works as expected. This is because the kubelet compares the container's current memory usage number to the the proposed memory limit decrease number. If the usage is lower, than we're good, and the resize can go through, and the VPA won't fall back to anything.
  2. In the case where the kubelet sees that memory usage is above the decreased limit number, then the kubelet will simply reject the resize, and try again later. In this case, the VPA will not fallback to recreate, but if the resize continues to stay in progress (i.e., if the pod continues to have the condition PodResizeInProgress for over 1 hour, then the VPA will finally mark this resize as failed and fallback to Recreate mode).
  3. The last case is where a race condition may happen and that the kubelet says we're good to resize, but in the time in between the kubelet signaling all is good and the time the resize actually goes through, it's possible the memory could've changed such that an OOM kill will happen.

This last case, I'm not entirely sure about because I'm not sure if the OOM kill restarts the container with the correct resources or not. If so, then we're okay.

If everything I'm assuming is correct, we should remove these references to falling back to pod recreation on memory limit decrease, but maybe I'm missing something.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions