Instructor: So this was a never key module
because you learned how you can persist data.
And you learned that you can do this
with volumes, of course.
What you already learned before in this course.
But with Kubernetes
since our application runs in potentially multiple parts,
potentially across multiple nodes, it's a bit more complex.
Now you can add volumes directly
in your pod specification,
since volumes are attached to pods
and configure everything there.
Like we did it before,
When we set this to hostPath
or simply to emptyDir
to have a very simple, basic volume.
Then we mounted into our container
with the volumeMounts configuration
and everything works as we're used to.
But especially if we have bigger applications,
running on multiple nodes, with multiple pods,
our data may still get lost
because volumes are attached to pods
and to nodes, by default.
That's why we can work with persistent volumes.
That allows us to create standalone detached volumes,
using a broad variety of supported types
which then will store the data somewhere else,
not in our nodes, not in our pods.
And that means that persistent volumes will survive
even if we shut down our pod,
and even if the pod then restarts on a different node.
The data is always the same because it's detached.
Now, you learned that a persistent volume alone
isn't worth that much.
We also need a persistent volume claim.
That persistent volume claim
is the counterpart to the persistent volume.
It defines how the volume should be claimed,
how much space we need,
and then it's this claim which we set as a volume on a pod,
like we're doing it here,
by using the persistent volume claim type.
This tells Kubernetes that this pod
wants to use this specific claim
to then target this specific volume defined in the claim.
And that's how we then have access to pod
and node independent storage and volumes,
inside of our application.
Now, besides that, over the last lectures,
we also learned about environment variables
which are easily added with the env key.
And then you learned,
we provide a name value field here,
or we alternatively use a config map
to store our data in there,
and retrieve data as a value
for an environment variable from there.
And that's basically it.
This is all you need to know as a foundation, at least,
when it comes to working with data
and volumes in Kubernetes-based applications.
With that, again, let's dig deeper into Kubernetes.