K8s Kubelet

PodUID

kubectl get pod <PID_NAME> -o=jsonpath='{.metadata.uid}'

POD on disk

/var/lib/kubelet/pods/<PodUID>/

/var/log/pods/<PodUID>/<container_name>

ls -l /var/log/pods/<PodUID>/<container_name>/
lrwxrwxrwx 1 root root 165 3月  30 06:52 0.log -> /var/lib/docker/containers/e74eafc4b3f0cfe2e4e0462c93101244414eb3048732f409c29cc54527b4a021/e74eafc4b3f0cfe2e4e0462c93101244414eb3048732f409c29cc54527b4a021-json.log

In a production cluster, logs are usually collected, aggregated, and shipped to a remote store where advanced analysis/search/archiving functions are supported. In kubernetes, the default cluster-addons includes a per-node log collection daemon, fluentd. To facilitate the log collection, kubelet creates symbolic links to all the docker containers logs under /var/log/containers with pod and container metadata embedded in the filename.

/var/log/containers/__-.log`

/var/log/containers/

ls -l 

Related

comments powered by Disqus