...

/

Persisting State through the emptyDir Volume Type

Persisting State through the emptyDir Volume Type

Analyze the state of an updated Jenkins Deployment and discuss emptyDir volume type.

Updating the Jenkins deployment definition

Let’s look at a slightly updated YAML definition of jenkins-empty-dir.yml.

Press + to interact
...
kind: Deployment
...
spec:
...
template:
...
spec:
containers:
...
volumeMounts:
- mountPath: /var/jenkins_home
name: jenkins-home
volumes:
- emptyDir: {}
name: jenkins-home
...

We add a mount that references the jenkins-home volume. This time, the volume type emptyDir. We’ll discuss the new volume type soon. But before we dive into explanations, we’ll try to experience its effects.

Press + to interact
kubectl apply \
-f jenkins-empty-dir.yml
kubectl rollout status deploy jenkins

We have applied the new definition and waited until the rollout finished.

Now we can open the “New Job” Jenkins screen and repeat the same process we followed before.

Press + to interact
kubectl port-forward service/jenkins 3000:8080 --address 0.0.0.0
#Open the link beside run button

Please type test in the “item name” field, select “Pipeline” as the type, click the “OK” button, and finish by clicking the “Save” button.

Now we’ll terminate the container and see what ...

Access this course and 1400+ top-rated courses and projects.