[kubernetes] k8s cluster framework, three core concepts, pod, controller, service


Today we are doing the second update of k8s, kubernetes cluster architecture and three core concepts.
insert image description here

1. kubernetes cluster architecture

Kubernetes includes master nodes and worker nodes, and the cluster architecture is shown in the figure:

insert image description here

1.1 Master node (Master)

The k8s cluster controls the nodes and schedules and manages the cluster. There are mainly four components.

insert image description here

API Service

The unified entry point of the cluster, which is requested in a restful style. Data is stored in etcd.

For example, to deploy an application according to the user's request, it must first go through the API Service, and then do the corresponding processing according to the specific requirements. Equivalent to the role of coordinator.

Scheduler

Node scheduling, select the node node for application deployment.

It is like a bus dispatching station, which arranges and dispatches according to the vehicle situation at a certain time. The Scheduler selects the corresponding node for application deployment according to the application deployment situation of the node node.

Controller MangerServer

Handle regular background work tasks in the cluster. Generally, one resource corresponds to one controller.

For example, there are many functions in a project, shopping cart, order and so on. Then these shopping cart or order resources correspond to a controller respectively. Dedicated and dedicated, unified management.

etcd

The storage system is used to save related data in the cluster.

Each component in the master node is equivalent to the role of a manager, and it handles application deployment accordingly.

1.2 Worker node (node)

Accepts requests from users outside the cluster to go to the cluster. There are mainly two components.

insert image description here

Kubelet

The manager in the node is equivalent to the representative sent by the Master to the node node. Manage various operations of native containers, such as container life cycle, container creation, destruction, etc.

Kube-proxy

Provide network proxy, load balancing and other operations.

2. Core concepts of kubernetes

2.1 Sub

  • smallest deployment unit
  • a collection of containers
  • shared network
  • life cycle is short

insert image description here

If container A listens on port 80, then B and C can also receive requests on port 80. For example, a pod container is equivalent to an application on a server, which can be accessed using localhost.

A pod is redeployed, its lifecycle ends, and a new pod is formed.

2.2 Controller

The main role of creating pods

  • Ensure the expected number of pod replicas
  • Stateless deployment, stateful deployment
  • Make sure all nodes are running the same pod
  • One-time and scheduled tasks

insert image description here

Replicas: The number of running pods.

Stateless deployment: The resource usage conditions are low and can be used on multiple nodes. Stateful deployment: There are certain deployment conditions, such as unique IP.

pod1 and pod2... on a node are the same.

2.3 Service

  • Defines access rules for a set of pods.

insert image description here

Like orders and shopping carts, services are forwarded to different pods for processing according to rules such as pod load capacity.

3. Summary

In practical work, we can refine the concepts mentioned above.

Pod
A pod is equivalent to a server. For example, I deployed two pods, which are equivalent to two servers of a physical machine to provide external services.

Unified entry
API Service: For the unified entry of the operation and maintenance side, perform container deployment and other work.
Service: A unified entry for the client, such as sending requests, processing services, etc.

Controller
Controller MangerServer: handles routine background work tasks in the cluster, targeting the master node.
Service: A unified entry for the client, such as sending requests, processing services, etc.

insert image description here
The WeChat public account has already been opened. You can find me by searching for "Jiang Xiaonan and his friends". Friends, you can pay attention to it. The following articles will be updated synchronously for easy viewing.

Guess you like

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