With docker, I can pass log-driver=syslog command line option to forward container logs to syslog. How do I pass these docker arguments via Kubernetes yaml/json descriptor?
Starting with the available documentation: in your case on logging and volumes. Taking these two sources together we arrive at something like the following:
...
containers:
- name: syslogtest
image: ubuntu:14.04
volumeMounts:
- name: logvol
mountPath: /dev/log
readOnly: false
volumes:
- name: logvol
source:
hostDir:
path: /dev/log
...
i dont think kubernetes need to do such --log-driver options in pod json file. As my experience, you can set such setting in docker service. i.e check
/etc/systemd/system/docker.service
and set ExecStart=/usr/bin/docker daemon --log-driver=json-file blablabla. more information could be get here: https://docs.docker.com/engine/admin/logging/overview/#configure-logging-drivers
further more, if you don't set this --log-driver, by default the json file will be created, which collected all logs of your containers in kubernetes pods, you can find those files on
your_docker_runtime_root/docker/containers/container_id/container_id-json.json
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