How to get container logs in kubernetes if user has no admin access to execute kubectl commands

34 views
Skip to first unread message

touseef

unread,
Oct 29, 2020, 2:43:27 AM10/29/20
to Jenkins Users
Can anyone provide pointer on  how do i get the logs of the containers running in kubernetes without using Kubectl because i dont have an access to the kubernetes cluster.
Is there any loging mechanism by which i can get the logs or stdout in the container to jenkins ? Help would be greatly appreciated.

Kari Cowan

unread,
Oct 29, 2020, 10:50:32 AM10/29/20
to jenkins...@googlegroups.com
Not sure if this would help, since I'm using Docker, not K8, but I bet there's a similar option - when I a start a container I use a -v flag to specify to copy the logs to the server it's running on.  This allows me to have a persistent log that won't just go away if I remove and restart the container.

example:
-v /path/to/server/log/directory:/path/from/container/logs/directory


On Wed, Oct 28, 2020 at 11:43 PM touseef <tousee...@gmail.com> wrote:
Can anyone provide pointer on  how do i get the logs of the containers running in kubernetes without using Kubectl because i dont have an access to the kubernetes cluster.
Is there any loging mechanism by which i can get the logs or stdout in the container to jenkins ? Help would be greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3b38d046-c55e-4e55-b9c3-7bc1d333a821n%40googlegroups.com.

David Karr

unread,
Oct 29, 2020, 11:50:42 AM10/29/20
to Jenkins Users
In general, it would be pretty silly if anyone could get access to the internals of a pod if they didn't have the proper authentication.

Is your enterprise using Jenkins to build the applications that you deploy to kubernetes?  Are those builds using kubectl to do those deployments?  If you can see the command lines in the build output, you can see how authentication is done. If that information is visible, then the enterprise likely considers anyone who can see that information to be trusted to access those pods for diagnostic information, so you should be able to do the same thing.
Message has been deleted

touseef

unread,
Oct 30, 2020, 6:56:21 AM10/30/20
to Jenkins Users

The issue is  i run my application on kubernetes  infrastructure which is not mainatined by me.However in case of issue i want some logs to debug It would have been straight forward if i had an access to the cluster via kubectl commands but that not the case, i.e why i some how want to get the log of the containers in which my application run in case i need it to debug  
Reply all
Reply to author
Forward
0 new messages