Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: rancher/rancher#39819
Internal dockershim never supported rotating logs for docker, see https://github.com/kubernetes/kubernetes/blob/v1.23.15/pkg/kubelet/kubelet.go#L643.
With introduction of CRI, it was expected for runtimes to add their own support and kubelet relies on
runtimeService
for the actual log. See https://github.com/kubernetes/kubernetes/blob/84e1fc493a47446df2e155e70fca768d2653a398/pkg/kubelet/logs/container_log_manager.go#L252.Because internal dockershim didn't support this feature, cri-dockerd doesn't have support for it either. It logs error that is seen constantly in logs: https://github.com/Mirantis/cri-dockerd/blob/master/core/logs.go#L47 Mirantis/cri-dockerd#35 (comment)
Workaround:
As mentioned in rancher/rancher#39819 (comment), rely on docker's
max-size
flag to perform log rotation.Note that it is required for this flag to be <= kubelet's
container-log-max-size
because it controls how often kubelet's rotateLogs is called. https://github.com/kubernetes/kubernetes/blob/v1.26.7/pkg/kubelet/logs/container_log_manager.go#L263Solution:
Use stub log manager for cri-dockerd runtime to maintain the internal dockershim's behavior. This will ensure the behavior remains same <v1.24 and users can configure docker daemon's capabilities to rotate logs.