<p>I have created a Jenkins cluster on Kubernetes (Master + 2 workers) with local volumes on the Master node.</p>

<p>I created a persistent vol of 2GB and the claim is 1 GB.</p>

<p>I created a deployment with the image: jenkins/jenkins:lts and volume mount from /var/jenkins_home to PVC: claimname</p>

<p>I have already copied the data on local folder which is Persistent Volume but I am not able to see my jobs on jenkins server.</p>

<pre><code>kubectl describe pod dep-jenkins-8648454f65-4v8tb
Events:
 Type     Reason       Age                      From                     Message
 ----     ------       ----                     ----                     -------
 Warning  FailedMount  3m38s (x149 over 4h50m)  kubelet, kube-worker001  MountVolume.SetUp failed for volume "default-token-424m4" : secret "default-token-424m4" not found
</code></pre>

<p>What is the correct way to mount a local directory in a POD so that I can transfer my Jenkins data to newly created Jenkins server on Kubernetes?</p>

Sunil
<p>Looks like the <code>Warning</code> in your pod description is related to mounting a secret and not mounting any PV. To set up your <code>JENKINS_HOME</code> as a persistent volume you would do something like this:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: jenkins
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      containers:
        - name: jenkins
          image: my-jenkins-image
          env:
            - name: JAVA_OPTS
              value: -Djenkins.install.runSetupWizard=false
          ports:
            - name: http-port
              containerPort: 8080
            - name: jnlp-port
              containerPort: 50000
          volumeMounts:
            - name: jenkins-home
              mountPath: /var/jenkins_home
      volumes:
      - name: jenkins-home
        persistentVolumeClaim:
          claimName: jenkins-home
</code></pre>
