Introduction to k8s (Kubernetes) architecture, the relationship between components of k8s (Kubernetes)

Note: This article aims to briefly introduce the k8s (Kubernetes) architecture to beginners, so that beginners have an overall impression, and will not be stunned by the complex structure of k8s, especially when there are no basic concepts such as containers and pods .

1. What is k8s?

You can look at the Chinese Wikipedia of Kubernetes.

Kubernetes (often shortened to K8s) is an open source system for automatically deploying, scaling and managing "containerized applications". The system was designed by Google and donated to the Cloud Native Computing Foundation (now the Linux Foundation) for use.

In other words, k8s is a system that can manage containerized applications . Beginners may often not be clear about basic concepts such as containers, docker, and Kubernetes and the relationship between them. You can refer to a blog I wrote: What is
k8s and the relationship between several basic concepts in k8s: container, docker, pod, deployment - harry's article

2. Introduction to k8s (Kubernetes) architecture

The following picture is the architecture diagram of k8s (source: k8s official website).
k8s architecture diagram
It can be seen that a Kubernetes cluster consists of two parts as a whole: Control Plane (control plane) and Node (node)

2.1 Control Plane (control plane)

Control Plane is also called master node (master node) in many places , and other nodes are also called worker nodes (working nodes) (there is also a master-worker construction idea).

Control plane components make global decisions for the cluster, such as scheduling of resources. As well as detecting and responding to cluster events, such as starting a new pod when a deployment's replicas field is not met).

Control plane components can run on any node in the cluster. However, for simplicity, the setup script will usually start all control plane components on the same machine and will not run user containers on this machine.

I think this is why Control Plane is called the master node.
It mainly includes the following parts:

  • The kube-apiserver API
    server is a component of the Kubernetes control plane. This component is responsible for exposing the Kubernetes API, handling the work of accepting requests , providing the only entry for resource operations, and providing authentication, authorization, access control, and related mechanisms . The API server is the front end of the Kubernetes control plane.

  • etcd
    is a consistent and highly available key-value store, used as the background database for all cluster data of Kubernetes, mainly saving the state of the entire cluster. etcd has a distributed, fault-tolerant design and is considered the ultimate source of truth for the cluster.

  • kube-scheduler kube-scheduler is responsible for monitoring newly created Pods that do not specify a running node (node), and schedules the node to allow Pod to run on the specified machine .

  • kube-controller-manager
    kube-controller-manager is the control plane component responsible for running the controller process. Responsible for maintaining the state of the cluster, such as failure detection, automatic expansion, rolling update, etc. Logically, each controller is a separate process, but to reduce complexity, they are all compiled into the same executable and run in the same process.

  • The cloud-controller-manager
    component is related to the cloud platform and does not require much attention. A Kubernetes control plane component that embeds cloud-specific control logic. The Cloud Controller Manager allows you to connect your cluster to a cloud provider's API and separate the components that interact with that cloud from the components that interact with your cluster. cloud-controller-manager only runs cloud platform-specific controllers. So if you are running Kubernetes in your own environment, or running a learning environment on your local machine, the deployed cluster does not need to have a cloud controller manager.

2.2 Node

The Node here is the worker node, which is responsible for processing real business needs. includes the following parts

  • kubelet
    This is a tiny application that communicates with the control plane. The kubelet ensures that containers run within a pod. When the control plane needs to perform an operation in a node, the kubelet performs that operation.

  • kube-proxy
    kube-proxy is a network proxy running on each node (node) in the cluster, and realizes part of the Kubernetes service (Service) concept.
    kube-proxy maintains some network rules on the nodes that allow network communication with pods from network sessions inside or outside the cluster.
    If the operating system provides a packet filtering layer available, kube-proxy will implement network rules through it. Otherwise, kube-proxy only forwards traffic.

  • Container Runtime (Container Runtime)
    **The container runtime environment is the software responsible for running containers. **Default container runtime is Docker; others are containerd, CRI-O, and any other implementation of Kubernetes CRI (Container Runtime Interface)

Of course, you can also choose some add-ons yourself, so I won’t repeat them here.

The following two pictures may be able to see the relationship between the various components of k8s more clearly
Master Node
Worker Node

3. The hierarchical idea embodied in the k8s (Kubernetes) architecture

In fact, it may not be possible to see the layered thinking in k8s here. There are pods, deployments, services, containers, etc. inside the worker node, which can better see the layered thinking. The layered implementation may need to be considered in a larger category.
You can refer to Reference 2. For example, there is a hierarchical relationship between the api interface and the ecosystem, that is, the ecosystem. External applications (such as monitoring) can use these api interfaces. The relationship between the management layer and the application layer includes the above-mentioned relationship between the master node and the worker node. **These are very in-depth knowledge.

References:

The following information is of high quality. If you want to learn more about it, I recommend you to read it.

  1. k8s official website
  2. https://www.kubernetes.org.cn/docs
  3. https://www.redhat.com/zh/topics/containers/kubernetes-architecture

Guess you like

Origin blog.csdn.net/Sansipi/article/details/127036449