<p>i'm using Jenkins to deploy pipeline, so first step i did it is deploying jenkins to minikube, and it's work at first, but each time i run <code>minikube stop</code>  and restart it , jenkins restart too from first (unlock jenkins), i just followed this tutorial :</p>
<p><a href="https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-kubernetes" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-kubernetes</a></p>
<p>and this is jenkins everytime i run minikube :
<a href="https://i.stack.imgur.com/6xnSa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6xnSa.png" alt="enter image description here" /></a></p>
<p>Hope someone have an answer for me ! thank you</p>

Lucia
<p>It looks like the secret is not mounted for deployment you can do it following</p>
<ol>
<li><p>create secret using</p>
<p><code>kubectl create secret jenkins --from-literal jenkins_password=&quot;ADD YOUR SECRET TOKEN Which you will find in jenkins pod logs&quot;</code></p>
</li>
</ol>
<p>and mount it like this</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
        env:
        - name: JENKINS_PASSWORD
          valueFrom:
            secretKeyRef:
              key: jenkins_password
              name: jenkins
        ports:
          - name: http-port
            containerPort: 8080
          - name: jnlp-port
            containerPort: 50000
        volumeMounts:
          - name: jenkins-data
            mountPath: /var/jenkins_home
      volumes:
        - name: jenkins-data
          persistentVolumeClaim:
            claimName: jenkins-data

</code></pre>
<p>Next time it will not ask your the token. Also I would highly recommend to use PVC for the data to persist. if you install plugin/or configure jobs etc. next time when you restart jenkin, the plugins/jobs will be gone.</p>
<p>so for pvc you can use it like this</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jenkins-data
  namespace: jenkins
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
</code></pre>
