How to simulate "-log-driver = syslog" in Kubernet

With docker, I can pass the command line parameter log-driver = syslog to forward container logs to syslog. How to pass these docker arguments through Kubernetes yaml / json descriptor?

+6
source share
3 answers

Starting with the available documentation: in your case, logging and volumes . Combining these two sources, we come to 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 ... 
+3
source

I do not think that kubernets should do such -log-driver options in the json pod file. In my experience, you can set such a setting in the docker service. check

 /etc/systemd/system/docker.service 

and set ExecStart = / usr / bin / docker daemon --log-driver = json-file blablabla. more information can be obtained here: https://docs.docker.com/engine/admin/logging/overview/#configure-logging-drivers

Further, if you did not install this -log driver, a json file will be created by default, which contains all the logs of your containers in kubernetes containers, you can find these files on

 your_docker_runtime_root/docker/containers/container_id/container_id-json.json 
+1
source

this has been discussed for quite some time here in this thread: https://github.com/kubernetes/kubernetes/issues/15478 , however the k8s community does recommend having its own dedicated logging agent. You can run it under each host machine or use it as a stroller or, moreover, recommend it as a DaemonSet.

See here for details: https://kubernetes.io/docs/concepts/cluster-administration/logging/#cluster-level-logging-architectures

Since k8s leaves dockerd and moves to containerd , you won’t even be able to configure the dockerd logging driver and logging options. so you can wait for the k8s community to add logging driver options, or use one of the above approaches.

0
source

Source: https://habr.com/ru/post/1236203/


All Articles