1
00:00:00,000 --> 00:00:11,000
Hi, Let us understand about deployments. Earlier we discussed about replica sets

2
00:00:11,000 --> 00:00:15,300
which is going to have a collection of pods and it's going to maintain the

3
00:00:15,300 --> 00:00:21,000
desired capacity. Sometimes there may be a need to change the replica set and

4
00:00:21,000 --> 00:00:26,133
replace the replica set with a different version. Let's take an example I do have

5
00:00:26,133 --> 00:00:31,133
version one of application running with desired capacity as 3 and I'm going to

6
00:00:31,133 --> 00:00:35,366
get a different version of application or the next version of the application

7
00:00:35,366 --> 00:00:41,332
and I want that to get deploy. There are two ways of deploying, one: I can start 3

8
00:00:41,333 --> 00:00:45,433
such containers and replace all the requests coming to the old version

9
00:00:45,433 --> 00:00:53,833
to the newer version or I can go in a staggered way or in a controlled rate I can switch the traffic. So whenever

10
00:00:53,833 --> 00:00:58,833
I wanted to make change to the replica set in a controlled rate and in a controlled

11
00:00:58,833 --> 00:01:02,966
way I can go ahead and use the deployments. So deployment is nothing

12
00:01:02,966 --> 00:01:08,866
but it's a declarative way of controlling the pods or internally the replica sets

13
00:01:08,866 --> 00:01:16,399
and making sure the availability of the replica set is changed in a controlled rate

14
00:01:16,400 --> 00:01:23,033
and this can be used for different type of use cases like rolling the new version of

15
00:01:23,033 --> 00:01:29,266
replica sets or replacing the applications with a different version and facing out

16
00:01:29,266 --> 00:01:33,732
any version of the applications or pausing the entire application for some

17
00:01:33,733 --> 00:01:39,599
reason as well as to scale up or scale down the load on any replica set

18
00:01:39,600 --> 00:01:45,566
Basically I'm going to control the pod or replica set in a declarative way and that's

19
00:01:45,566 --> 00:01:50,699
where the deployments will be used. As we discussed earlier directly we will not

20
00:01:50,700 --> 00:01:54,000
be controlling the replica set in production we will be using the

21
00:01:54,000 --> 00:01:59,333
deployments or the auto scaling. Let's go ahead and create a sample deployment

22
00:01:59,333 --> 00:02:05,166
As a part of kubernetes website I do have the github user content over here.

23
00:02:05,166 --> 00:02:10,232
I'm going to use the web link directly and use kubectl apply and see how it's going

24
00:02:10,233 --> 00:02:15,599
to work. Here I do have the api version and kind as deployment within spec I do

25
00:02:15,600 --> 00:02:21,433
have replica as 3 and selector I am using the app as nginx, so this is what the label

26
00:02:21,433 --> 00:02:26,966
will be used to do the selection and the new pod will get created using this

27
00:02:26,966 --> 00:02:31,666
specific template and it will be using this specific label and it will be using the

28
00:02:31,666 --> 00:02:36,299
container with the name nginx and image as this specific image and port 80 will

29
00:02:36,300 --> 00:02:43,166
get exposed. Let me go ahead and apply this particular file, so automatically the

30
00:02:43,166 --> 00:02:46,999
file will get referred and the deployment will get created. Let me go ahead and

31
00:02:47,000 --> 00:02:52,833
get the deployments so I do have a deployment where zero objects are ready

32
00:02:52,833 --> 00:02:58,066
and the desired capacity needs to be 3. I can go ahead and do the description of

33
00:02:58,066 --> 00:03:03,132
this specific deployment, I can get the deployment details using the describe

34
00:03:03,133 --> 00:03:08,333
command and get the information. So here I do have the details about the name

35
00:03:08,333 --> 00:03:12,299
in which namespace it got created what are all the annotations that is

36
00:03:12,300 --> 00:03:17,300
the api version and what is the selector, this is the important label it's going to

37
00:03:17,300 --> 00:03:23,633
use to select the pods and whether it is part of this specific deployment or not

38
00:03:23,633 --> 00:03:29,399
and 3 desired capacity, yes I do have 3 number of pods available and as a part

39
00:03:29,400 --> 00:03:33,500
of blue-green deployment as well as the deployment strategy we will be

40
00:03:33,500 --> 00:03:37,766
discussing about the rolling update and what these specific values are, this is

41
00:03:37,766 --> 00:03:41,299
just a quick introduction on various concepts and objects available as a part

42
00:03:41,300 --> 00:03:48,166
of kubernetes. Now let me go ahead and get the replica set available as a part of

43
00:03:48,166 --> 00:03:52,832
this specific deployment, so I can get the replica set so this is what the replica set

44
00:03:52,833 --> 00:03:58,199
name I am going to get, let me give the command get rs, so this is the replica set

45
00:03:58,200 --> 00:04:02,600
available as a part of the deployment. If I get into the description of the

46
00:04:02,600 --> 00:04:07,200
deployment here I will be having the new deployment that is active and there is no

47
00:04:07,200 --> 00:04:12,500
old deployments available. In case if I wanted to roll it to a new version I will be

48
00:04:12,500 --> 00:04:18,300
getting the new replica set name over here and their status and within the

49
00:04:18,300 --> 00:04:22,400
replica set I should have n number of pods I can go ahead and get the pods as

50
00:04:22,400 --> 00:04:27,000
well, let me use the command kubectl get pods so these are all the pods

51
00:04:27,000 --> 00:04:31,833
available as a part of the specific deployment and I can get the pods with a

52
00:04:31,833 --> 00:04:37,333
label. So all the pods should have that specific label app is equal to nginx. So

53
00:04:37,333 --> 00:04:41,599
this is what the app selector that's going to use to make it as a part of the

54
00:04:41,600 --> 00:04:47,033
deployment or the replica set. So what's going to happen it's going to use the

55
00:04:47,033 --> 00:04:52,499
replica set internally and make use of the desired capacity and the collection of

56
00:04:52,500 --> 00:04:57,900
pods how to use the label selector and get the n number of pods up and running

57
00:04:57,900 --> 00:05:02,500
The most of the use cases we will be using is the controlled way of deploying

58
00:05:02,500 --> 00:05:07,233
or making changes to the replica set or to the auto scaling we will be using the

59
00:05:07,233 --> 00:05:11,633
deployments. We can go ahead and scale up the deployments as well as

60
00:05:11,633 --> 00:05:16,233
scale down the deployments and make changes to the deployments at runtime

61
00:05:16,233 --> 00:05:19,999
all those we will be discussing it as a part of advanced discussion of

62
00:05:20,000 --> 00:05:24,033
deployments. So in a quick summary we have seen what is a deployment and how

63
00:05:24,033 --> 00:05:27,799
it is going to use replica sets and pods, label selector as a part

64
00:05:27,800 --> 00:05:30,966
of the deployment internally and in what use cases and how

65
00:05:30,966 --> 00:05:35,166
it will be used within the kubernetes.

