1
00:00:02,140 --> 00:00:04,890
<v Instructor>So this was a never key module</v>

2
00:00:04,890 --> 00:00:08,290
because you learned how you can persist data.

3
00:00:08,290 --> 00:00:09,840
And you learned that you can do this

4
00:00:09,840 --> 00:00:11,540
with volumes, of course.

5
00:00:11,540 --> 00:00:14,400
What you already learned before in this course.

6
00:00:14,400 --> 00:00:15,760
But with Kubernetes

7
00:00:15,760 --> 00:00:19,780
since our application runs in potentially multiple parts,

8
00:00:19,780 --> 00:00:24,320
potentially across multiple nodes, it's a bit more complex.

9
00:00:24,320 --> 00:00:26,430
Now you can add volumes directly

10
00:00:26,430 --> 00:00:28,500
in your pod specification,

11
00:00:28,500 --> 00:00:31,150
since volumes are attached to pods

12
00:00:31,150 --> 00:00:33,010
and configure everything there.

13
00:00:33,010 --> 00:00:34,490
Like we did it before,

14
00:00:34,490 --> 00:00:37,300
When we set this to hostPath

15
00:00:37,300 --> 00:00:39,200
or simply to emptyDir

16
00:00:39,200 --> 00:00:41,633
to have a very simple, basic volume.

17
00:00:42,500 --> 00:00:44,310
Then we mounted into our container

18
00:00:44,310 --> 00:00:46,680
with the volumeMounts configuration

19
00:00:46,680 --> 00:00:49,063
and everything works as we're used to.

20
00:00:49,970 --> 00:00:52,960
But especially if we have bigger applications,

21
00:00:52,960 --> 00:00:56,150
running on multiple nodes, with multiple pods,

22
00:00:56,150 --> 00:00:58,327
our data may still get lost

23
00:00:58,327 --> 00:01:01,750
because volumes are attached to pods

24
00:01:01,750 --> 00:01:04,830
and to nodes, by default.

25
00:01:04,830 --> 00:01:07,920
That's why we can work with persistent volumes.

26
00:01:07,920 --> 00:01:11,770
That allows us to create standalone detached volumes,

27
00:01:11,770 --> 00:01:15,130
using a broad variety of supported types

28
00:01:15,130 --> 00:01:18,170
which then will store the data somewhere else,

29
00:01:18,170 --> 00:01:21,410
not in our nodes, not in our pods.

30
00:01:21,410 --> 00:01:24,960
And that means that persistent volumes will survive

31
00:01:24,960 --> 00:01:27,770
even if we shut down our pod,

32
00:01:27,770 --> 00:01:31,080
and even if the pod then restarts on a different node.

33
00:01:31,080 --> 00:01:34,920
The data is always the same because it's detached.

34
00:01:34,920 --> 00:01:37,450
Now, you learned that a persistent volume alone

35
00:01:37,450 --> 00:01:38,810
isn't worth that much.

36
00:01:38,810 --> 00:01:42,030
We also need a persistent volume claim.

37
00:01:42,030 --> 00:01:44,160
That persistent volume claim

38
00:01:44,160 --> 00:01:47,220
is the counterpart to the persistent volume.

39
00:01:47,220 --> 00:01:50,410
It defines how the volume should be claimed,

40
00:01:50,410 --> 00:01:52,110
how much space we need,

41
00:01:52,110 --> 00:01:57,110
and then it's this claim which we set as a volume on a pod,

42
00:01:57,380 --> 00:01:58,720
like we're doing it here,

43
00:01:58,720 --> 00:02:02,070
by using the persistent volume claim type.

44
00:02:02,070 --> 00:02:04,520
This tells Kubernetes that this pod

45
00:02:04,520 --> 00:02:07,090
wants to use this specific claim

46
00:02:07,090 --> 00:02:12,090
to then target this specific volume defined in the claim.

47
00:02:13,850 --> 00:02:16,080
And that's how we then have access to pod

48
00:02:16,080 --> 00:02:19,000
and node independent storage and volumes,

49
00:02:19,000 --> 00:02:20,943
inside of our application.

50
00:02:21,830 --> 00:02:24,450
Now, besides that, over the last lectures,

51
00:02:24,450 --> 00:02:26,930
we also learned about environment variables

52
00:02:26,930 --> 00:02:29,460
which are easily added with the env key.

53
00:02:29,460 --> 00:02:30,470
And then you learned,

54
00:02:30,470 --> 00:02:33,160
we provide a name value field here,

55
00:02:33,160 --> 00:02:36,130
or we alternatively use a config map

56
00:02:36,130 --> 00:02:37,950
to store our data in there,

57
00:02:37,950 --> 00:02:40,020
and retrieve data as a value

58
00:02:40,020 --> 00:02:42,640
for an environment variable from there.

59
00:02:42,640 --> 00:02:44,610
And that's basically it.

60
00:02:44,610 --> 00:02:48,320
This is all you need to know as a foundation, at least,

61
00:02:48,320 --> 00:02:50,260
when it comes to working with data

62
00:02:50,260 --> 00:02:53,790
and volumes in Kubernetes-based applications.

63
00:02:53,790 --> 00:02:57,223
With that, again, let's dig deeper into Kubernetes.

