Attaching claimed volumes to Pods

cat pv/jenkins-pv.yml  

The relevant parts of the output is as follows:

...
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: jenkins
  namespace: jenkins
spec:
  ...
  template:
    ...
    spec:
      containers:
      - name: jenkins
        ...
        volumeMounts:
        - name: jenkins-home
          mountPath: /var/jenkins_home
        ...
      volumes:
      - name: jenkins-home
        persistentVolumeClaim:
          claimName: jenkins
      ...  

You'll notice that, this time, we added a new volume jenkins-home, which references the PersistentVolumeClaim called jenkins. From the container's perspective, the claim is a volume.

Let's deploy Jenkins resources and confirm that everything works as expected.

kubectl apply \
    -f pv/jenkins-pv.yml \
    --record  

The output is as ...

Get The DevOps 2.3 Toolkit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.