The applications usually log to the standard output (stdout) and standard error (stderr) streams instead of writing their logs to files.
This is to allow users to view logs of different applications in a simple, standard way.
The kubelet, Kubernetes node agent, is taking care of it.
Which collects these streams and writes them to a local file behind the scenes.
So that you can easily access them with Kubernetes.
Kubelet writes the pods’ logs to the same node on which the pod is running.
You can only retrieve container logs of pods that are still in existence.
When the pod is deleted, its logs are also deleted.
To make a pod’s logs available even after the pod is deleted, you need to set up centralised, cluster-wide logging.
Which stores all the logs in a central store. Tools like FluentD helps in this.
For more info please visit our website www.mtroview.com