1
00:00:01,382 --> 00:00:04,090
Now, before we dig into kubernetes

2
00:00:04,090 --> 00:00:07,840
and volumes there is a certain term which I wanna clarify,

3
00:00:07,840 --> 00:00:10,250
and that would be State.

4
00:00:10,250 --> 00:00:13,590
You could kind of translate state with data,

5
00:00:13,590 --> 00:00:16,590
in the end it's just data which is created

6
00:00:16,590 --> 00:00:20,790
and used by your application which must not be lost.

7
00:00:20,790 --> 00:00:24,180
And there are different kinds of such state.

8
00:00:24,180 --> 00:00:27,050
There for example is user-generated data,

9
00:00:27,050 --> 00:00:28,980
like to story where storing

10
00:00:28,980 --> 00:00:32,183
or something like a user account which was created.

11
00:00:33,040 --> 00:00:36,130
There also are intermediate results

12
00:00:36,130 --> 00:00:37,720
which are derived by the app

13
00:00:37,720 --> 00:00:39,850
and which are also needed

14
00:00:39,850 --> 00:00:42,853
but which eventually will be lost and cleared.

15
00:00:43,860 --> 00:00:46,000
Now the user-generated to data,

16
00:00:46,000 --> 00:00:49,070
the user accounts and whatever your app is about

17
00:00:49,070 --> 00:00:52,270
that data is typically stored in databases

18
00:00:52,270 --> 00:00:56,620
but maybe also in files, Like in the example I gave you

19
00:00:56,620 --> 00:01:01,620
where we store the data in this story text file.

20
00:01:02,450 --> 00:01:04,910
Now for the intermediate results that

21
00:01:04,910 --> 00:01:07,740
is often storage Just in memory

22
00:01:07,740 --> 00:01:11,380
or in temporary database tables or files.

23
00:01:11,380 --> 00:01:14,090
But whichever kind of data you're dealing with,

24
00:01:14,090 --> 00:01:17,350
the key thing is that this data needs

25
00:01:17,350 --> 00:01:19,640
to survive container restarts,

26
00:01:19,640 --> 00:01:22,170
especially the data on the left side, of course,

27
00:01:22,170 --> 00:01:25,670
and that is exactly what we have volumes for.

28
00:01:25,670 --> 00:01:28,940
This is nothing new and nothing kubernetes specific,

29
00:01:28,940 --> 00:01:31,600
I just want us to emphasize does again,

30
00:01:31,600 --> 00:01:33,780
that is why we use volumes

31
00:01:33,780 --> 00:01:38,040
because this data matters and must not be lost just

32
00:01:38,040 --> 00:01:40,920
because a container is stopped and was removed.

33
00:01:40,920 --> 00:01:45,240
And it does not matter if we're working with Docker locally

34
00:01:45,240 --> 00:01:47,510
and with Docker and Docker compose,

35
00:01:47,510 --> 00:01:49,860
or if we're working with kubernetes

36
00:01:49,860 --> 00:01:53,113
because we wanna deploy that data onto a cluster.

37
00:01:54,180 --> 00:01:56,590
Especially, if we work with kubernetes

38
00:01:56,590 --> 00:01:59,680
and we are planning to deploy our application

39
00:01:59,680 --> 00:02:04,430
we of course need to ensure that crucial data is not lost.

40
00:02:04,430 --> 00:02:07,470
I mean, your application wouldn't be worth much

41
00:02:07,470 --> 00:02:11,160
if your user data would suddenly be gone, right?

42
00:02:11,160 --> 00:02:13,400
So that's why we have volumes

43
00:02:13,400 --> 00:02:16,100
and of course we already know that solution.

44
00:02:16,100 --> 00:02:18,530
As I mentioned, we already know volumes

45
00:02:18,530 --> 00:02:22,210
and volumes still matter when working with kubernetes

46
00:02:22,210 --> 00:02:26,320
because ultimately we're still dealing with containers.

47
00:02:26,320 --> 00:02:30,940
So of course, this solution for persisting data

48
00:02:30,940 --> 00:02:34,100
which we already learned about is not obsolete,

49
00:02:34,100 --> 00:02:36,040
we still need it.

50
00:02:36,040 --> 00:02:38,700
However, we of course have to keep in mind

51
00:02:38,700 --> 00:02:42,050
that now when working with kubernetes,

52
00:02:42,050 --> 00:02:45,110
it's kubernetes that runs our containers.

53
00:02:45,110 --> 00:02:48,450
It's not us, we don't run Docker run

54
00:02:48,450 --> 00:02:50,550
or a Docker Compose command.

55
00:02:50,550 --> 00:02:54,780
Instead, we use kubernetes and we orchestrate

56
00:02:54,780 --> 00:02:58,090
our cluster and our deployment with kubernetes

57
00:02:58,090 --> 00:03:00,810
and kubernetes then creates these pods

58
00:03:00,810 --> 00:03:03,070
which then run our containers.

59
00:03:03,070 --> 00:03:06,490
So we don't directly launch our containers.

60
00:03:06,490 --> 00:03:08,220
And therefore of course,

61
00:03:08,220 --> 00:03:10,970
we can't provide a Docker compose file

62
00:03:10,970 --> 00:03:15,380
and we can't add the dash V flag when using Docker run,

63
00:03:15,380 --> 00:03:18,770
instead we need to configure Kubernetes such

64
00:03:18,770 --> 00:03:21,360
that it adds volumes to our containers.

65
00:03:21,360 --> 00:03:23,560
And that's exactly what we're going to dive into

66
00:03:23,560 --> 00:03:26,280
in this module, in this course section.

67
00:03:26,280 --> 00:03:30,830
How we can get Kubernetes to create and add volumes

68
00:03:30,830 --> 00:03:33,703
to the containers it starts for us.

