1
00:00:00,760 --> 00:00:06,270
Unless sexually made a very small change to our pod configuration file a container port.

2
00:00:06,430 --> 00:00:11,680
But when we did so we very quickly saw an error message that said that we were not allowed to update

3
00:00:11,680 --> 00:00:14,070
certain fields that are tied to a pod.

4
00:00:14,110 --> 00:00:18,460
So essentially that message is telling us that there are some fields so we are allowed to update such

5
00:00:18,460 --> 00:00:20,680
as the image that a pod uses.

6
00:00:20,920 --> 00:00:23,770
But there are other fields so we are not allowed to touch at all.

7
00:00:23,800 --> 00:00:28,630
Once the pod has been created and so this kind of flies in the face of everything I just told you about

8
00:00:28,690 --> 00:00:31,150
making changes to the configuration file.

9
00:00:31,180 --> 00:00:36,620
In other words how are we going to change a configuration file to change an object inside of our cluster.

10
00:00:36,760 --> 00:00:42,700
If there are fields that we are not at all allowed to update or touch well to solve this issue we're

11
00:00:42,700 --> 00:00:49,000
going to start making use of a new type of object that is going to replace our usage of pod inside of

12
00:00:49,000 --> 00:00:52,060
our very simple application as it stands right now.

13
00:00:52,090 --> 00:00:57,040
So the new type of object that we're going to make use of in addition to pods and services is something

14
00:00:57,040 --> 00:01:04,990
called a deployment deployment is a Nettie's object that is meant to maintain a set of identical pods

15
00:01:05,170 --> 00:01:11,020
so that can be one part two part three pod whatever number and the deployment is going to constantly

16
00:01:11,020 --> 00:01:15,850
work to make sure that every single pod in its set that it's supposed to manage is always running that

17
00:01:15,850 --> 00:01:19,930
can correct configuration and is always in a runnable state.

18
00:01:19,930 --> 00:01:24,490
In other words it is not crashing or it's not dead or anything like that.

19
00:01:24,580 --> 00:01:28,110
Now a deployment is very similar in nature to a pod.

20
00:01:28,300 --> 00:01:32,070
Yes I just said a deployment contains a set or maintains a set of pods.

21
00:01:32,080 --> 00:01:38,260
But at the end of the day we can use either deployments or pods with Kuber Nettie's to run containers

22
00:01:38,770 --> 00:01:41,050
for our application.

23
00:01:41,110 --> 00:01:45,640
So let's compare and contrast the differences between pods and deployments.

24
00:01:45,670 --> 00:01:51,640
So with the pod we're running a single set of very closely related containers remember in a pod.

25
00:01:51,700 --> 00:01:56,020
We're only going to stick in multiple multiple containers if they have very tight integration with each

26
00:01:56,020 --> 00:01:57,340
other.

27
00:01:57,550 --> 00:02:03,610
In reality pods are only used in a development environment and usually only if you have like a very

28
00:02:03,700 --> 00:02:08,560
one off single container or a very small group of containers you want to run.

29
00:02:08,560 --> 00:02:13,930
We do not actually make use of pods directly in a production environment because of all these limitations

30
00:02:13,990 --> 00:02:18,310
around being able to update its configuration and stuff like that.

31
00:02:18,370 --> 00:02:25,120
Now a deployment on the other hand again is meant to set or is meant to run and manage a set of identical

32
00:02:25,120 --> 00:02:25,740
ports.

33
00:02:25,780 --> 00:02:32,280
So that is one or more likely one pod to pod three pod however many you want in that set of pods.

34
00:02:32,280 --> 00:02:38,420
Every part is going to be running the exact same set of containers with identical configuration now

35
00:02:38,920 --> 00:02:42,480
the deployment itself is going to monitor the state of each pod.

36
00:02:42,580 --> 00:02:46,540
It's going to watch the configuration of each one it's going to make sure that every pod is running

37
00:02:46,540 --> 00:02:48,480
the containers successfully inside of it.

38
00:02:48,730 --> 00:02:54,130
If any pod happens to crash for any reason the deployment is going to automatically attempt to restart

39
00:02:54,130 --> 00:02:58,330
that pod or completely recreate it in a fresh new state.

40
00:02:58,510 --> 00:03:04,480
We make use of deployments in a development environment and we use them as the primary means of running

41
00:03:04,480 --> 00:03:07,510
containers in a production environment as well.

42
00:03:07,510 --> 00:03:11,810
So in this course I first started off showing you pods just so you understand.

43
00:03:11,890 --> 00:03:15,710
Here is a very basic way of creating a container with Kubert Nettie's.

44
00:03:15,910 --> 00:03:21,280
But in reality when we start making use of communities for any serious purpose we make use of deployments

45
00:03:21,370 --> 00:03:23,390
as opposed to individual pots.

46
00:03:23,590 --> 00:03:30,970
So from here on forward we're going to kind of tend to forget that pods exist and we're going to instead

47
00:03:31,030 --> 00:03:36,130
make use of deployments for running all of our different containers again behind the scenes a deployment

48
00:03:36,130 --> 00:03:40,510
is just making use of pods so it's still very important to understand what a pod is and how you work

49
00:03:40,510 --> 00:03:41,200
with one.

50
00:03:41,200 --> 00:03:46,460
But again we're going to make use of deployments in our development and production environments.

51
00:03:46,580 --> 00:03:52,850
Now I want to show you is just a very quick diagram here of what's going on behind the scenes.

52
00:03:52,870 --> 00:03:58,260
So when we create a deployment object it's going to have attached to it something called a pod template

53
00:03:58,690 --> 00:04:03,970
a pod template is essentially a little block of configuration file or see a little block configuration

54
00:04:04,180 --> 00:04:09,230
that says hey here's what any pod that is created by this deployment is supposed to look like.

55
00:04:09,280 --> 00:04:15,010
So the template might say OK every pod that this deployment manages is supposed to have one container

56
00:04:15,280 --> 00:04:21,070
that has the name of client that exposes port three thousand and uses the image multi worker.

57
00:04:21,220 --> 00:04:26,230
And so that deployment would use this template to create a pod that looks like this a pod that has a

58
00:04:26,230 --> 00:04:35,570
name of client pod just simply client it's running the multi worker image and it exposes 43000 to the

59
00:04:35,570 --> 00:04:37,060
outside world.

60
00:04:37,190 --> 00:04:43,700
If we made a change to the template over here like let's say were instead supposed to expose port 3000

61
00:04:44,850 --> 00:04:50,610
we changed that to 9 9 9 like so then the deployment would attempt to either change the existing pod

62
00:04:50,610 --> 00:04:55,800
that it's managing or alternatively it would attempt to kill this part entirely and replace it with

63
00:04:55,800 --> 00:05:00,390
a brand new pod that has the correct port assigned to it like so.

64
00:05:00,390 --> 00:05:05,220
So again this deployment object over here is going to be constantly watching all of the different pods

65
00:05:05,220 --> 00:05:10,220
that it maintains it's going to be watching their state and making sure that they have the correct state.

66
00:05:10,230 --> 00:05:15,210
So at the end of the day to solve this issue that we're having right now with updating the configuration

67
00:05:15,210 --> 00:05:20,940
for our pod rather than trying to make use of a POD and update the container port we're going to instead

68
00:05:20,970 --> 00:05:29,010
refactor this thing to instead be a deployment that creates a pod running the multi worker image and

69
00:05:29,070 --> 00:05:31,530
with a very specific container port.

70
00:05:31,560 --> 00:05:36,180
Once you make use of the deployment all those restrictions around updating certain variables like say

71
00:05:36,180 --> 00:05:40,430
the container port right here or the name of the container will be lifted with a deployment.

72
00:05:40,440 --> 00:05:44,180
We can change any piece of configuration tied to a pod that we want to.

73
00:05:44,310 --> 00:05:48,310
We don't have to worry about seeing that error message like we did previously.

74
00:05:48,330 --> 00:05:49,950
OK so let's take a quick pause right here.

75
00:05:49,950 --> 00:05:51,490
We're going to come back in the next section.

76
00:05:51,570 --> 00:05:57,150
We're going to start to Reflektor our client pod file or just completely recreate it for that matter.

77
00:05:57,240 --> 00:06:00,950
And we're going to turn it into a deployment object type instead.

78
00:06:01,000 --> 00:06:02,480
So I'll see you in just a minute.
