kubernetes: InPlacePodVerticalScaling does not meet the requirement of qosClass being equal to Guaranteed after shrinking the memory
What happened?
InPlacePodVerticalScaling does not meet the requirement of qosClass being equal to Guaranteed after shrinking the memory
What did you expect to happen?
InPlacePodVerticalScaling maintains the same qosclass type of Pod before and after scaling
How can we reproduce it (as minimally and precisely as possible)?
After enabling the InPlacePodVerticalScaling feature, the patch modifies the request and limit of the container’s resource to a value smaller than usage
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
# paste output here
Client Version: version.Info{Major:“1”, Minor:“24”, GitVersion:“v1.24.1”, GitCommit:“3ddd0f45aa91e2f30c70734b175631bec5b5825a”, GitTreeState:“clean”, BuildDate:“2022-05-24T12:17:11Z”, GoVersion:“go1.18.3”, Compiler:“gc”, Platform:“darwin/amd64”} Kustomize Version: v4.5.4 Server Version: version.Info{Major:“1”, Minor:“29”, GitVersion:“v1.29.2”, GitCommit:“4b8e819355d791d96b7e9d9efe4cbafae2311c88”, GitTreeState:“clean”, BuildDate:“2024-02-14T22:24:00Z”, GoVersion:“go1.21.7”, Compiler:“gc”, Platform:“linux/amd64”}
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 30 (28 by maintainers)
I just opened https://github.com/kubernetes/kubernetes/issues/129152 about some inconsistencies in the check that leads to this behavior.
If we do decide to keep this protection in place, I’d like to propose an alternative solution: move the limits < usage check to
canResizePod. This means that if you’re trying to shrink memory limits below usage, the pod will be held in a deferred state, rather than being stuck in an in-progress state. This also addresses the issue of QOS Class inconsistency, since we won’t end up in a partial-resize state.As I put a comment here, the resizing got failed in kubelet: https://github.com/kubernetes/kubernetes/blob/b5bc8025be6179ff49ea2edf654a6b855ae00119/pkg/kubelet/kuberuntime/kuberuntime_manager.go#L743
I reproduced this issue on v1.30.
Create a namespace and a pod following the documentation:
Update the memory limit and request with a quite low value (1Mi):
Confirm the container status:
Then, I noticed the
status.resizeis “InProgress”:Though I’m not familiar with this feature, I guess the runtime is still trying to resize the pod. This issue seems caused because the updated value is too small to be practical.
After this situation, I patched another update with a practical value:
Then, the pod was resized with the later patch:
This issue can be solved by another patch. So, I don’t think this causes a big problem.
i can’t reproduce this issue in the same 1.29 version, my pod.yaml:
then patch pod:
i got this error: