...

/

Creating Deployment for Attaching Claimed Volumes to Pods

Creating Deployment for Attaching Claimed Volumes to Pods

Learn to create a Jenkins deployment for attaching claimed volumes to Pods and look into the sequence of associated events.

In the previous lesson, we looked into claiming the persistent volumes. The next step is to attach these claimed volumes to pods.

Looking into the definition

Let’s look into a Jenkins definition:

Press + to interact
cat pv/jenkins-pv.yml

The relevant parts of the output as as follows:

Press + to interact
...
apiVersion: apps/v1
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 add a new volume jenkins-home, which references the PersistentVolumeClaim called jenkins. From the container’s perspective, the claim is a ...