Closed hshiina closed 4 days ago
/sig node
@hshiina This is a bug. Can you submit a PR to fix it? If not, I'd be happy to work on it
@zhifei92 If you are interested, please feel free to assign yourself.
@zhifei92 If you are interested, please feel free to assign yourself.
thx
/assign
/triage accepted /priority important-longterm
What happened?
EphemeralContainerStatuses
is not normalized innormalizeStatus()
in the status manager: https://github.com/kubernetes/kubernetes/blob/cade1dddd81eba338df85de7b5d17324a87243b5/pkg/kubelet/status/status_manager.go#L1026-L1043This does not seem to cause any user facing problem because
EphemeralContainerStatuses
is sorted before passed to the status manager and timestamps are normalized at marshaling to create a patch: https://github.com/kubernetes/kubernetes/blob/cade1dddd81eba338df85de7b5d17324a87243b5/pkg/kubelet/kubelet_pods.go#L2336https://github.com/kubernetes/kubernetes/blob/cade1dddd81eba338df85de7b5d17324a87243b5/pkg/kubelet/status/status_manager.go#L873
However, an unexpected behavior is caused internally because timestamps are not normalized. If the log verbosity is 3 or larger, the following messages are logged periodically in kubelet when an ephemeral container exists:
This message is emitted here: https://github.com/kubernetes/kubernetes/blob/cade1dddd81eba338df85de7b5d17324a87243b5/pkg/kubelet/status/status_manager.go#L984-L988
After
needsReconcile()
returnstrue
,syncPod()
is called. This does not look so harmful becauseunchaged
getstrue
eventually:https://github.com/kubernetes/kubernetes/blob/cade1dddd81eba338df85de7b5d17324a87243b5/pkg/kubelet/status/status_manager.go#L873-L881
API is called once unnecessarily in
syncPod()
, though: https://github.com/kubernetes/kubernetes/blob/cade1dddd81eba338df85de7b5d17324a87243b5/pkg/kubelet/status/status_manager.go#L843What did you expect to happen?
It might be better to normalize ephemeral container statuses, at least timestamps, in the status manager to avoid this unexpected behavior.
How can we reproduce it (as minimally and precisely as possible)?
Set the log verbosity of kubelet to 3 or larger. Then, create an ephemeral container like this.
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)