-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubelet does not sync pod updates for static pods #116597
Comments
/sig node |
/triage accepted this is not a regression, is it? |
IIUC, this is not even a bug, in light of info that static pods are not expected to be resized via API , which I was unsure of when I created this issue. @smarterclayton please confirm. That said, Imho it might be desirable to resize under/over provisioned static pods based on observed usage for better cluster utilization. |
hmm, in this case is the If that's the case, I think it's expected that the image will not change. The mirror pod is suppose to be read only and reflect the static pod manifest on disk which is the source of truth. So I would expect that it would not be possible to change the static pod via updating the mirror pod. I have #116725 open which is similar issue, but slightly different -- if the static pod manifest is updated on disk, then it is expected that the mirror pod spec should be updated as well. |
Yes, the source of truth for spec of a static pod is the config on the node, not the mirror pod. There is no component today that reconciles the state of the pod spec on mirror pods, which would be part of #16627 through David's issue. The HandlePodUpdate is triggered to indicate that the status of the pod has changed, which is part of the flow of status info from kubelet -> api -> back to pod worker. |
Hey, I searched for the above code in the master branch and it has been removed by this PR #102884. Also, I'm new to k8s and finding my first issue to work on, if my deduction in wrong in anyway. Please feel free to point it out (Happy to take brutal feedback) |
We need to be very careful about handling any updates from the apiserver for mirror pods, as there is potential for a security issues compromising node isolation here. Mirror pods are the only type of pods that nodes are allowed to create, and in the past we've had some close calls that were mitigated by the fact that Kubelets basically ignore mirror pods. |
What happened?
When a static pod is created on a node, it's mirror pod is created on the apiserver. Patching the mirror pod on the apiserver triggers HandlePodUpdate function in the kubelet:
kubernetes/pkg/kubelet/kubelet.go
Lines 2491 to 2502 in fcf5d23
However, handleMirrorPod sets up SyncPodUpdate for the original pod instead of the updated pod.
kubernetes/pkg/kubelet/kubelet.go
Lines 2412 to 2420 in fcf5d23
As a result, SyncPod does not really process the updates for static pods.
What did you expect to happen?
Pod updates should be processed for static pods in the same manner as they are processed for normal pods.
How can we reproduce it (as minimally and precisely as possible)?
Start local cluster w/ latest master (as of Mar 14, 2023):
Create static pod:
Verify image in container status of the static pod:
Patch container image:
# ./cluster/kubectl.sh patch pod bbox-127.0.0.1 --patch '{"spec":{"containers":[{"name":"ctr", "image":"busybox:1.34"}]}}' pod/bbox-127.0.0.1 patched
Check pod spec of static pod and verify image has been updated:
After some time, check container status of static pod:
Repeat exercise with normal pod to verify that container restarts and image has been updated.
Anything else we need to know?
No response
Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: