1
00:00:01,070 --> 00:00:04,130
Hello and welcome to this lecture. In this lecture

2
00:00:04,130 --> 00:00:10,910
we will talk about Kube Controller Manager. As we discussed earlier, the kube controller manager manages

3
00:00:10,970 --> 00:00:17,920
various controllers in Kubernetes. A controller is like an office or department within the master ship

4
00:00:17,980 --> 00:00:23,890
that have their own set of responsibilities. Such as an office for the Ships would be responsible for

5
00:00:23,890 --> 00:00:26,960
monitoring and taking necessary actions about the ships.

6
00:00:27,010 --> 00:00:32,110
Whenever a new ship arrives or when a ship leaves or gets destroyed another office could be one that

7
00:00:32,110 --> 00:00:37,700
manages the containers on the ships they take care of containers that are damaged or full of ships.

8
00:00:37,780 --> 00:00:45,480
So these officers are number 1, continuously on the lookout for the status of the ships and 2, take

9
00:00:45,520 --> 00:00:50,700
necessary actions to remediate the situation. In the kubernetes terms

10
00:00:50,880 --> 00:00:56,730
a controller is a process that continuously monitors the state of various components within the system

11
00:00:57,090 --> 00:01:01,670
and works towards bringing the whole system to the desired functioning state.

12
00:01:01,710 --> 00:01:07,770
For example the node controller is responsible for monitoring the status of the nodes and taking necessary

13
00:01:07,770 --> 00:01:10,610
actions to keep the application running.

14
00:01:10,620 --> 00:01:13,420
It does that through the kube-api server.

15
00:01:13,590 --> 00:01:17,550
The node controller checks the status of the nodes every 5 seconds.

16
00:01:17,550 --> 00:01:22,800
That way the node controller can monitor the health of the nodes if it stops receiving heartbeat from

17
00:01:22,800 --> 00:01:31,460
a node the node is marked as unreachable but it waits for 40 seconds before marking it unreachable after

18
00:01:31,460 --> 00:01:38,280
a node is marked unreachable it gives it five minutes to come back up if it doesn’t, it removes the

19
00:01:38,280 --> 00:01:42,890
PODs assigned to that node and provisions them on the healthy ones.

20
00:01:42,990 --> 00:01:48,980
If the PODs are part of a replica set the next controller is the replication controller.

21
00:01:49,030 --> 00:01:54,520
It is responsible for monitoring the status of replica sets and ensuring that the desired number of

22
00:01:54,520 --> 00:01:58,240
PODs are available at all times within the set.

23
00:01:58,300 --> 00:02:01,800
If a pod dies it creates another one.

24
00:02:01,850 --> 00:02:04,960
Now those were just two examples of controllers.

25
00:02:05,000 --> 00:02:08,990
There are many more such controllers available within kubernetes.

26
00:02:08,990 --> 00:02:15,180
Whatever concepts we have seen so far in kubernetes such as deployments, Services, namespaces,

27
00:02:15,180 --> 00:02:21,890
persistent volumes and whatever intelligence is built into these constructs it is implemented through

28
00:02:21,890 --> 00:02:23,740
these various controllers.

29
00:02:23,900 --> 00:02:29,240
As you can imagine this is kind of the brain behind a lot of things in kubernetes.

30
00:02:29,480 --> 00:02:34,330
Now how do you see these controllers and where are they located in your cluster.

31
00:02:34,380 --> 00:02:39,460
They're all packaged into a single process known as kubernetes controller manager.

32
00:02:39,670 --> 00:02:45,150
When you install the kubernetes controller manager the different controllers get installed as well.

33
00:02:45,250 --> 00:02:47,140
So how do you install and view the kubernetes

34
00:02:47,140 --> 00:02:53,200
Controller manager download the kube-controller-manager from the kubernetes release page. Extract it and

35
00:02:53,200 --> 00:02:54,550
run it as a service.

36
00:02:54,700 --> 00:03:01,060
When you run it as you can see there are a list of options provided this is where you provide additional

37
00:03:01,060 --> 00:03:03,590
options to customize your controller.

38
00:03:03,610 --> 00:03:08,810
Remember some of the default settings for node controller we discussed earlier such as the node monitor

39
00:03:08,810 --> 00:03:12,490
period the grace period and the eviction  timeout.

40
00:03:12,490 --> 00:03:15,700
These go in here as options.

41
00:03:15,700 --> 00:03:20,890
There is an additional option called controllers that you can use to specify which controllers to enable.

42
00:03:21,490 --> 00:03:22,390
By default

43
00:03:22,390 --> 00:03:27,110
all of them are enabled but you can choose to enable a select few.

44
00:03:27,210 --> 00:03:32,890
So in case any of your controllers don't seem to work or exist this would be a good starting point to

45
00:03:32,890 --> 00:03:33,190
look at.

46
00:03:34,400 --> 00:03:37,370
So how do you view the Kube-controller-manager server options?

47
00:03:37,370 --> 00:03:39,540
Again it depends on how you set up your cluster.

48
00:03:39,560 --> 00:03:45,170
If you set it up with kubeadm tool, kubeadm deploys the kube-controller-manager as a pod in the

49
00:03:45,170 --> 00:03:51,350
kube-system namespace on the master node. You can see the options within the pod definition file located

50
00:03:51,350 --> 00:03:57,980
at etc kubernetes manifests folder. In a non-kubeadm setup, you can inspect the options by viewing

51
00:03:57,980 --> 00:04:02,460
the kube-controller-manager service located at the services directory.

52
00:04:02,510 --> 00:04:07,760
You can also see the running process and the effective options by listing the process on the master

53
00:04:07,760 --> 00:04:10,610
node and searching for kube-controller-manager.

54
00:04:11,430 --> 00:04:14,910
Well that's it for this lecture and I will see you in the next.
