-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
I think some parts of our existing docs are not correct anymore with 1.34.
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:
- 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.
- 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
PodResizeInProgressfor over 1 hour, then the VPA will finally mark this resize as failed and fallback toRecreatemode). - 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.