Add logrotate config file to aks node

4/14/2020

I want to add logrotate config file for pods and containers on aks node which is a linux machine. I was able to achieve it by login to the node in azure and manually adding them at /etc/logrotate.d path. But my code has cases where I may have to deploy again which removes those changes. How can I make it persist or add those config files such that they are created on aks node when deployed again?

FYI: I use arm templates for deployment.

-- Mathew
azure
azure-aks
kubernetes

1 Answer

4/14/2020

with AKS you shouldn't need to setup Log Rotate on the nodes itself to manage log rotation for container.

This is the responsibility of Docker and AKS properly configures the rotation of such logs.

xinfra@aks-linux-vmss000000:~$ cat /etc/docker/daemon.json
{
  "live-restore": true,
  "log-driver": "json-file",
  "log-opts":  {
     "max-size": "50m",
     "max-file": "5"
  }
}
-- djsly
Source: StackOverflow