I have some up & running kubernetes cluster which potentially can produce a lot of logs. Kubernetes is running on top of docker so I think I need to configure dockerd to rollout logs.
I found some settings for logging driver for dockerd:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10k",
"max-file": "2"
}
}
In case of docker service restart the changes are successfully applied.
du /var/lib/docker/containers/container_hash/container_hash* -h
shows log files splitted on chunks by appropriate size.
But I don't want to restart the daemon, so tried to reload configuration with:
sudo kill -SIGHUP $(pidof dockerd)
In syslog I found:
Mar 12 15:38:16 kso-gl dockerd[5331]: time="2018-03-12T15:38:16.446894155+02:00" level=info msg="Got signal to reload configuration, reloading fr
om: /etc/docker/daemon.json"
So, I assume the configuration was reloaded. Unfortunately it had no effect. Even for new containers. Looks like subsystem related to logging drivers ignores configuration reload.
Restart the Docker daemon. On Linux, you can avoid a restart (and avoid any downtime for your containers) by reloading the Docker daemon. If you use systemd , then use the command systemctl reload docker . Otherwise, send a SIGHUP signal to the dockerd process.
always: Always restart the container if it stops, or is manually stopped due to the daemon stopping. unless-stopped: Always restart the container, unless the daemon is stopped, at which point, the container must be restarted manually.
On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced. You can also start the Docker daemon manually and configure it using flags. This can be useful for troubleshooting problems.
Sadly it appears the configuration reload SIGHUP feature does not support all configuration options.
The docs at https://docs.docker.com/v17.09/engine/reference/commandline/dockerd/#miscellaneous-options (See the "CONFIGURATION RELOAD BEHAVIOR" section) tell us the only supported configuration options which can be reloaded in this way are:
The list of currently supported options that can be reconfigured is this:
debug: it changes the daemon to debug mode when set to true.
cluster-store: it reloads the discovery store with the new address.
cluster-store-opts: it uses the new options to reload the discovery store.
cluster-advertise: it modifies the address advertised after reloading.
labels: it replaces the daemon labels with a new set of labels.
live-restore: Enables keeping containers alive during daemon downtime.
max-concurrent-downloads: it updates the max concurrent downloads for each pull.
max-concurrent-uploads: it updates the max concurrent uploads for each push.
default-runtime: it updates the runtime to be used if not is specified at container creation. It defaults to “default” which is the runtime shipped with the official docker packages.
runtimes: it updates the list of available OCI runtimes that can be used to run containers
authorization-plugin: specifies the authorization plugins to use.
allow-nondistributable-artifacts: Replaces the set of registries to which the daemon will push nondistributable artifacts with a new set of registries.
insecure-registries: it replaces the daemon insecure registries with a new set of insecure registries. If some existing insecure registries in daemon’s configuration are not in newly reloaded insecure resgitries, these existing ones will be removed from daemon’s config.
registry-mirrors: it replaces the daemon registry mirrors with a new set of registry mirrors. If some existing registry mirrors in daemon’s configuration are not in newly reloaded registry mirrors, these existing ones will be removed from daemon’s config.
Which, as you can see, does not include the log-driver
or log-opts
configuration parameters.
I'm not aware of a way to reload the logging configuration without a restart, at this time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With