fix: update kubelet log path for containerd support#864
Open
fix: update kubelet log path for containerd support#864
Conversation
Update kubernetes_logging.yml to use the standard kubelet log path /var/log/pods/*/*/*.log instead of Docker-specific path. This change: - Makes log rotation compatible with containerd and other container runtimes - Uses the standard Kubernetes pod log location - Maintains daily log rotation with 2 backups (3 days total retention) - Enables proper log lifecycle management by kubelet - Improves integration with log collection tools like Loki and Promtail The logrotate configuration: - Rotates logs daily - Keeps 2 rotated backups (maxage: 1 day) - Uses copytruncate for safe rotation without process interruption - Skips if directory doesn't exist yet (missingok flag) Tested on: Kubernetes v1.29.10 with containerd v1.7.22 All 3 nodes (kubenode1, kubenode2, kubenode3) successfully updated.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
Update
kubernetes_logging.ymlto use the standard kubelet log path instead of Docker-specific paths.Changes
/var/lib/docker/containers/*/*.logto/var/log/pods/*/*/*.logWhy This Change?
Modern Kubernetes clusters increasingly use containerd instead of Docker. The current configuration is Docker-specific and doesn't work reliably with containerd. The new path:
Testing
This change has been successfully tested on:
Configuration Details
The logrotate settings remain unchanged:
Files Changed
ansible/kubernetes_logging.yml- Single file, minimal changeNote: The
/var/log/pods/directory will be created by kubelet when it starts using this path. Logrotate hasmissingokflag so it won't fail if the directory doesn't exist initially.