How To Rotate Container Logs on The Master and Worker Nodes
Problem
Container logs are utilizing all the disk space on the master and worker nodes.
Environment
Platform9 Managed Kubernetes - All Versions
Docker
Cause
The docker service is not configured to rotate the container logs.
Resolution
Back up the /etc/docker/daemon.json file on the affected node if present. Add the log rotation config on the node in the file /etc/docker/daemon.json file as shown below.
$ less /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "50m",
"max-file": "5"
}
}Stop the Platform9 Managed Kubernetes stack by executing commands in the below sequence.
Restart the docker service.
Start the Platform9 Managed Kubernetes stack by executing the commands in the below sequence.
Verify the changes took effect on the container by running below command.
PreviousHow To Avoid Placement of More Than One Pod Replicas on Same Worker Node
NextHow To Disable and Re-enable Dynamic Kubelet Configuration
Last updated
