[kubernetes] In-depth understanding of Kubernetes component relationships, one picture and one story is enough

Kubernetes components

Official documentation: https://kubernetes.io/en/docs/concepts/overview/components/

In the official documentation of kubernetes, we can see such an architecture diagram.

insert image description here

It can be seen from the figure that a complete kubernetes cluster includes Control Plane Components and Node components.

1. Control Plane Components

Components of the control plane make global decisions about the cluster (such as scheduling), as well as detect and respond to cluster events. Include:

  • cube apiserver
  • etcd
  • kube-scheduler
  • kube-controller-manager
  • cloud-controller-manager

2. Node Components

Node components run on each node, maintain running Pods and provide the Kubernetes runtime environment. Include:

  • kubelet
  • kube-proxy

For the functions and roles of these components, you can refer to the official documentation, which I also mentioned in previous articles. Today we will focus on how the various components are related and how they work with each other in a cluster environment.

3. Mutual working relationship

In order to facilitate understanding, I have made some additional explanations for this picture to fit the actual situation to help everyone understand.

insert image description here

The janitor (kube-proxy) controls network access in the cluster, and data can be shared between them . The secretariat (kube-apiserver) controls interactive access between clusters.

The headquarters base here is equivalent to the control node (Master Node), and each branch is equivalent to the work node (Work Node). We give each component a corresponding role, so it is easier to understand the relationship between them working with each other.

insert image description here

First of all, we need to obtain the following information from the figure:

  • Whether it is a control node or a worker node, there can be a kubelet
  • Whether it is a control node or a worker node, you can have kube-proxy
  • Whether it is a control node or a working node, specific business can be done. For example, aircraft building can be done in the branch factory, and the headquarters can also do it, but in practice, it is generally done by the branch factory.

In the previous article, we talked about the functions and characteristics of each component. How do they work together?

We understand through a story.

A large company has a headquarters and two branches, A and B. Factory A's original business included aircraft, train and shipbuilding. The original business of Factory B included aircraft and shipbuilding. One day, the director of Factory A inspected the assembly line and found that the factory did not have the conditions to build trains, so he told the secretariat the news. The secretariat received the news and reported the situation to the decision makers. After the decision makers heard the news, they said: Factory A can’t do it, so let other factories do it. So the secretariat told the decision maker what the decision maker meant. The operator worked hard day and night. After all, he could let factory B do it, so he told the secretariat. After the secretariat got the news, it put all the information into the database, and then told the factory manager B, so the factory manager B Factory B started the business of building trains.

In the previous article, we also said that kube-proxy provides network proxy and load balancing. How do you understand it here?

One day, a worker on the application 1 (aircraft building) assembly line wanted to see the shipbuilding assembly line, so he found the doorman and wanted to learn from him where to look at the shipbuilding assembly line, so the doorman told him, Our factory A has it, and we also have it in factory B, so the workers on the assembly line chose a factory assembly line to visit according to what the guard said. Of course, people in the factory can ask the uncle guard. If you are outside the factory, you also need to ask the uncle guard.

These are all situations within a cluster. If you need resources outside the cluster, you can use the cloud-controller-manager to obtain them.

4. Control the master node

Through the above story, we understand the process of how the various components work together. In actual work, we will also find that the headquarters (Master Node) is actually more like a puppet.

insert image description here

Programmers can control the headquarters (Master) through commands, such as kubectl create deploy myapp --image=tomcatetc. Accomplish the effect we want to meet the business needs. Of course, the relationship process between components and so on is still the situation we talked about in the above story.

The WeChat public account has been opened first. You can find me by searching for "Jiang Xiaonan and his friends". Friends, you can pay attention. The article will be updated synchronously for easy viewing.

Guess you like

Origin blog.csdn.net/weixin_45842494/article/details/123463654