Save the kubernetes container logs on the host node where the pod is deployed.

109 views
Skip to first unread message

Ashish r

unread,
Aug 20, 2018, 5:17:21 PM8/20/18
to Kubernetes user discussion and Q&A
Hello all,

I have implemented a 3 Master kubernetes cluster that works perfectly fine. I have been deploying some apps to test out the network. Assume I have deployed an application app1. There is only 1 replica of this pod on one of the kubernetes worker nodes. I am also writing the logs of the app to a file on the container . If for some reason, the container dies (the application service running inside the container died) the kubernetes master will bring up another pod/container. But I would like to view the logs of the container that has died so as to understand the root cause of the issue. 

I have give through this documentation but it only mentions about saving the log file on the container. 
But I would atleast like to store it on my worker node or the master so that I do not loose the logs. 

I am looking for better ways of doing this. Any suggestion is highly appreciated and please let me know if I need to provide any additional information. Thanks in advance. 


Cheers,
Ashish

Rodrigo Campos

unread,
Aug 20, 2018, 9:33:26 PM8/20/18
to kubernet...@googlegroups.com
You can write to stdout and see the logs of the crashed container with kubectl logs (or kubectl logs --previous or something like that was the flag called).

Usually writing to stdout is a good practice:-)
--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

gaurav gundal

unread,
Aug 21, 2018, 7:02:38 AM8/21/18
to kubernet...@googlegroups.com


Adding to the above question.
What is the best practice to copy the application or service logs from the container to the vm that host the container?
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.

Niranjan Kolly

unread,
Aug 21, 2018, 10:51:37 AM8/21/18
to kubernet...@googlegroups.com
Mount the vm path as hostpat..what ever writes in the containers will come sit in ur vm... 

On Tue, Aug 21, 2018, 4:32 PM gaurav gundal <gaurav...@gmail.com> wrote:


Adding to the above question.
What is the best practice to copy the application or service logs from the container to the vm that host the container?


On Aug 20, 2018, at 9:33 PM, Rodrigo Campos <rodr...@gmail.com> wrote:

You can write to stdout and see the logs of the crashed container with kubectl logs (or kubectl logs --previous or something like that was the flag called).

Usually writing to stdout is a good practice:-)

On Monday, August 20, 2018, Ashish r <ashish...@gmail.com> wrote:
Hello all,

I have implemented a 3 Master kubernetes cluster that works perfectly fine. I have been deploying some apps to test out the network. Assume I have deployed an application app1. There is only 1 replica of this pod on one of the kubernetes worker nodes. I am also writing the logs of the app to a file on the container . If for some reason, the container dies (the application service running inside the container died) the kubernetes master will bring up another pod/container. But I would like to view the logs of the container that has died so as to understand the root cause of the issue. 

I have give through this documentation but it only mentions about saving the log file on the container. 
But I would atleast like to store it on my worker node or the master so that I do not loose the logs. 

I am looking for better ways of doing this. Any suggestion is highly appreciated and please let me know if I need to provide any additional information. Thanks in advance. 


Cheers,
Ashish

--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages