How do kube-system pods logs get stored on the hosting node?

7/30/2021

As a preface, the reason I am asking this question is that my application wants something similar: store logs on the file system of the node hosting the pods.

I read in https://kubernetes.io/docs/concepts/cluster-administration/logging/#system-component-logs this:

System components inside containers always write to the /var/log directory, bypassing the default logging mechanism. They use the klog logging library.

Does klog somehow has a special access to /var/log? How? My application now uses standard syslog logging, and on containers this ends up writing to stderr.

-- Sam Habiel
kubernetes

1 Answer

7/30/2021

The question turns out to be unneeded. I looked carefully, and the logs of my application are ALSO in /var/log/containers. It's just that they disappear when the pods are deleted. That's my next problem to solve.

-- Sam Habiel
Source: StackOverflow