<p>I have installed kubernetes cluster thus I have a deployment file for jenkins.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      containers:
      - name: jenkins
        image: jenkins/jenkins:lts
        ports:
          - name: http-port
            containerPort: 8080
          - name: jnlp-port
            containerPort: 50000
        volumeMounts:
          - name: jenkins-vol
            mountPath: /var/jenkins_vol
            spec:
      volumes:
        - name: jenkins-vol
          emptyDir: {}
</code></pre>
<p>The only thing I need is to install kubernetes client (Kubectl) through curl request.
The problem is that when I enter the pod and create curl request it returns Permission denied</p>
<pre><code>curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.20.2/bin/linux/amd64/kubectl
Warning: Failed to create the file kubectl: Permission denied
</code></pre>

<p>Try adding securityContext in your deployment</p>
<pre><code>spec:
  securityContext:
    runAsUser: 0
</code></pre>
<p>If this doesnt work,( your jenkins deployment is failing or some other issue), then when you enter the pod ( pod exec) check what user is it by running <code>id</code> or <code>whoami</code></p>
