Jenkins Deployment on Kubernetes has a problem with logs

5/6/2019

I made a Jenkins Deployment on Kubernetes. It works fine but when I try to show container logs an error occurs.

$ kubectl logs jenkins-5b587f57b8-tfz2f
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
-- Eugene Lopatkin
jenkins
kubernetes

1 Answer

5/6/2019

Good working solution i found is adding a Security Context:

securityContext:
 fsGroup: 1000 
 runAsUser: 0

to Jenkins Deployment spec.

-- Eugene Lopatkin
Source: StackOverflow