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

<pre><code>$ 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
</code></pre>

<p>Good working <a href="https://www.thoutam.com/2018/08/13/jenkins-copy_reference_file-log-permission-denied-issue-in-k8s/" rel="noreferrer">solution</a> i found is adding a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/" rel="noreferrer">Security Context</a>:</p>

<pre><code>securityContext:
 fsGroup: 1000 
 runAsUser: 0
</code></pre>

<p>to Jenkins Deployment spec.</p>
