1
00:00:05,080 --> 00:00:06,850
Hello and welcome to this lecture.

2
00:00:06,850 --> 00:00:08,650
My name is Mumshad Mannambeth.

3
00:00:08,890 --> 00:00:09,730
In this lecture

4
00:00:09,730 --> 00:00:15,060
we will discuss about Kubernetes Deployments. For a minute,

5
00:00:15,070 --> 00:00:22,420
let us forget about PODs and replicasets and other kubernetes concepts and talk about how you might

6
00:00:22,480 --> 00:00:26,340
want to deploy your application in a production environment.

7
00:00:26,380 --> 00:00:32,280
Say for example you have a web server that needs to be deployed in a production environment.

8
00:00:32,500 --> 00:00:39,130
You need not one but many such instances of the web server running for obvious reasons.

9
00:00:39,130 --> 00:00:46,150
Secondly whenever newer versions of application builds become available on the docker registry you would

10
00:00:46,150 --> 00:00:49,990
like to upgrade your Docker instances seamlessly.

11
00:00:49,990 --> 00:00:55,940
However when you upgrade your instances you do not want to upgrade all of them at once

12
00:00:55,930 --> 00:01:02,740
as we just did. This may impact users accessing our applications, so you might want to upgrade them one

13
00:01:02,740 --> 00:01:03,940
after the other.

14
00:01:04,120 --> 00:01:08,140
And that kind of upgrade is known as rolling updates.

15
00:01:08,140 --> 00:01:14,410
Suppose one of the upgrades you performed resulted in an unexpected error and you're asked to undo the

16
00:01:14,410 --> 00:01:21,900
recent change you would like to be able to roll back the changes that were recently carried out. Finally,

17
00:01:21,960 --> 00:01:28,410
say for example you would like to make multiple changes to your environment such as upgrading the underlying

18
00:01:28,410 --> 00:01:34,320
WebServer versions, as well as scaling your environment and also modifying the resource allocations etc.

19
00:01:34,320 --> 00:01:35,250
WebServer versions, as well as scaling your environment and also modifying the resource allocations etc.

20
00:01:35,340 --> 00:01:41,340
You do not want to apply each change immediately after the command is run instead you would like to

21
00:01:41,340 --> 00:01:47,760
apply a pause to your environment, make the changes and then resume so that all changes are rolled-out

22
00:01:47,760 --> 00:01:55,280
together. All of these capabilities are available with the kubernetes Deployments. So far in this course

23
00:01:55,290 --> 00:02:02,280
we discussed about PODs, which deploy single instances of our application such as the web application

24
00:02:02,310 --> 00:02:10,440
in this case. Each container is encapsulated in PODs. Multiple such PODs are deployed using Replication

25
00:02:10,440 --> 00:02:17,880
Controllers or Replica Sets. And then comes Deployment which is a kubernetes object that comes higher

26
00:02:17,880 --> 00:02:19,620
in the hierarchy.

27
00:02:19,620 --> 00:02:26,400
The deployment provides us with the capability to upgrade the underlying instances seamlessly using

28
00:02:26,400 --> 00:02:32,830
rolling updates, undo changes, and pause and resume changes as required.

29
00:02:32,850 --> 00:02:37,210
So how do we create a deployment. As with the previous components,

30
00:02:37,230 --> 00:02:43,590
We first create a deployment definition file. The contents of the deployment definition file are exactly

31
00:02:43,590 --> 00:02:51,090
similar to the replica set definition file, except for the kind, which is now going to be deployment. If

32
00:02:51,090 --> 00:02:52,860
we walk through the contents of the file

33
00:02:52,860 --> 00:03:00,540
it has an apiVersion which is apps/v1, metadata which has name and labels and a spec that

34
00:03:00,540 --> 00:03:03,800
has template, replicas and selector.

35
00:03:03,840 --> 00:03:11,390
The template has a pod definition inside it. Once the file is ready run the kubectl create command

36
00:03:11,480 --> 00:03:18,470
and specify the deployment definition file. Then run the kubectl get deployments command to see

37
00:03:18,470 --> 00:03:23,880
the newly created deployment. The deployment automatically creates a replica set.

38
00:03:23,900 --> 00:03:26,990
So if you run the kubectl get replcaset command

39
00:03:27,020 --> 00:03:32,110
You will be able to see a new replica set in the name of the deployment.

40
00:03:32,210 --> 00:03:34,900
The replicasets ultimately create pods,

41
00:03:34,940 --> 00:03:38,150
so if you run the kubectl get pods command

42
00:03:38,150 --> 00:03:43,570
you will be able to see the pods with the name of the deployment and the replicaset.

43
00:03:43,610 --> 00:03:50,360
So far there hasn't been much of a difference between replica set and deployments except for the fact

44
00:03:50,390 --> 00:03:55,750
that deployments created a new kubernetes object called deployments.

45
00:03:55,760 --> 00:04:01,130
We will see how to take advantage of the deployment using the use cases we discussed in the previous

46
00:04:01,130 --> 00:04:07,420
slide in the upcoming lectures and one more note before we end this lecture.

47
00:04:07,460 --> 00:04:15,170
To see all the created objects at once run the kubectl get all command and in this case we can

48
00:04:15,170 --> 00:04:22,220
see that the deployment was created and then we have the replica set followed by three pods that were

49
00:04:22,220 --> 00:04:24,700
created as part of the deployment.

50
00:04:24,710 --> 00:04:25,940
That's it for this lecture.
