当前位置:网站首页>Kubernetes technology and Architecture (VI)

Kubernetes technology and Architecture (VI)

2022-07-23 10:47:00 uesowys

1      Preface

1.1   CNCF

1.2    Cloud native

1.3    Public cloud services

1.4    Private cloud services

1.5    Hybrid cloud services

2     Kubernetes Definition

2.1    Basic concepts

2.2    Architecture evolution

2.2.1  Traditional deployment (Traditional deployment 

2.2.2  Virtualization deployment (Virtualized deployment

2.2.3  Containerized deployment (Container deployment

2.3    Use scenarios

2.4    Use constraints

3     Kubernetes framework

3.1    Cluster architecture

3.2    Control surface (Control Plane) Components

3.2.1 kube-apiserver

3.2.2 etcd

3.2.3 kube-scheduler

3.2.4 kube-controller-manager

3.2.5 cloud-controller-manager

3.3    node (Node) Components

3.3.1 kubelet

3.3.2 kube-proxy

4     Kubernetes technology

4.1    Containerization Technology

4.1.1 cgroups technology

4.1.1.1  The basic definition

4.1.1.2  Core interface file

4.1.1.3  Basic operation

4.1.1.3.1      mount

4.1.1.3.2      process

4.1.1.3.3      Threads

4.1.1.3.4      event

4.1.1.3.5      controller

4.1.1.3.6      Delegation of authority

4.1.1.3.7      Guiding principles

4.1.1.4  Resource distribution model

4.1.1.4.1      The weight

4.1.1.4.2      Limit

4.1.1.4.3      Protect

4.1.1.4.4      Distribute

4.1.1.5  controller

4.1.1.5.1      processor

4.1.1.5.2      Memory

4.1.1.5.3     IO

4.1.1.5.4      process

4.1.1.5.5      equipment

4.1.1.5.6     RDMA

4.1.2 Docker Container running environment

From the perspective of system architecture ,docker Just a container running environment , Deployed in docker Other features of the application in , For example, high availability 、 high reliability 、 high scalability 、 Elastic scalability and other related non functional features need Kubernetes Guarantee of architecture . This chapter mainly describes docker Properties related to the operating environment of the container .

From the analysis of the previous chapters ,Kubernetes Use kubelet Component docking Kubernetes Containerization CRI Interface and docker Container running environment , therefore , Users can use kubelet The operation commands provided by the component operate directly docker Container running environment .

4.1.2.1 Docker framework

As shown in the figure above ,docker The architecture consists of the following parts :

Docker daemon

The process is in each server host docker Run the background process of the environment , Responsible for listening to requests 、 management docker Objects include mirrors 、 Containers 、 Network and storage capacity , Multiple docker Background processes can communicate with each other

Docker client

Docker The client is a console , Users can use the console to communicate with  docker Processes communicate with each other, such as sending operation instructions , Users can work with multiple docker Processes communicate with each other

Docker registries

Docker The registry is responsible for storing docker Container mirror (images), Users can publish container images to the registry for management , Users can pull the corresponding container image from the registry and deploy it in the local container running environment

Docker objects

Container objects include the following categories :

Mirror image (images): A container image (image) Is a read-only file , Provide the container running environment with a runtime docker Container instance , In general , A running environment needs to rely on other components , therefore , A container image can rely on other container images . Users can use dockerfile Create a container image , You can also go straight from docker The image registry downloads container images . Users can rebuild the container image and republish it to the container image registry . therefore ,docker It is a container technology that is lighter than virtual machine technology .

Containers (Containers): A container (container) It's a container image (image) Running instance of . Users can use docker Client command creation 、 start-up 、 stop it 、 Move 、 Delete a container . The user can specify the network of the container 、 Storage and container isolation level .

4.1.2.2  Use scenarios

As shown in the figure above ,docker Containerization technology in practice devops Usage scenarios in the architecture . stay devops In the standardization process ,docker The image registration center of is the central area connecting the development stage and the operation and maintenance stage , It's the realization of CI Continuous integration with CD The central link of continuous release .

Empathy , stay kubernetes When arranging application services in the environment , You can also pull the application service image corresponding to the business from the above container image center , Using this method, traditional docker Environment and kubernetes Environmental Science , So that the same image can be quickly released to different environments .

4.1.3 containerd Container running environment

containerd It's the realization of kubernetes Of CRI Container running environment with standard interface .

4.1.3.1 Containerd framework

Containerd yes CNCF Standard projects , From the above architecture diagram ,docker And kubernetes All use containerd Running environment as container .Containerd Realization kubernetes Standards for CRI Interface , therefore ,kubernetes have access to kubelet The client realizes the full life cycle management of container objects in the container running environment .

Containerd The main structure of is divided into API The interface layer 、 Core layer 、 Back end layer , As follows :

API The interface layer

The interface layer provides three open module interfaces , Namely containerd client、service handlers、metrics

containerd client: Provide external clients , It can be directly used or docked CRI Standard interface

service handlers: Service interface of protocol type provided externally

metrics: Provide an interface of information statistics type , from Prometheus Component implementation

Core layer

Container service layer , Provide different services , Including container metadata management 、 Container image management 、 Container object management and other related services

Backend layer

Underlying technical services at the operating system level , It mainly connects the core functions of the interaction between the kernel state and user state of the operating system

4.1.3.2  Use scenarios

stay containerd It can be seen from the architecture diagram , In the construction field of the upper ecosystem , Most cloud manufacturers use CNCF The key components of cloud native serve as cloud supporting platform .

4.1.4 Pod Basic concepts of

4.1.4.1 Pod The definition of

Pod yes kubernetes Cluster architecture is the smallest unit to realize resource scheduling ,Pod Encapsulates the container object described in the above section ,Pod You can encapsulate one or more container objects , The container image corresponding to the business application can be run in each container object , therefore , One Pod The container objects in share this Pod The resources allocated , Include namespace 、cgroup Controlled, such as processor or memory related system resources 、 Network resources 、 Storage resources, etc . among ,Pod And Pod They are independent of each other and realize resource isolation . As shown below :Pod Example of deployment structure :

As shown in the figure above , The Pod Include multiple container objects ,Pod Objects within share the same storage capacity .

4.1.4.2 Pod Compiling

Kubernetes Provide a set of standard specifications support Pod Compiling , Using this specification, we can achieve Pod The application arrangement in and the scheduling of corresponding resources , An example is shown below :

Use the command to execute Pod Can run the specified Pod:

kubectl apply -f pod.yaml

4.1.4.3 Pod Life cycle of

4.1.4.3.1     Pod The stage of

One Pod The life cycle of is divided into the following stages :

Pending

This stage represents Pod Already in kubernetes Cluster creation complete , Waiting to pull the image from the container image center to the local and run the container object and wait kubernetes Schedule the resources needed to run the container image

Running

This stage represents Pod Has been kubernetes Dispatch to the specified work node ,Pod All container objects in have been created , At least one container object has been running successfully or started normally or is being restarted

Succeeded

This stage represents Pod All container objects in have been successfully terminated , And will no longer be restarted

Failed

This stage represents Pod All container objects in have been successfully terminated , And at least one container object fails to be terminated , That is, the object is forcibly terminated by the system or exits stateless

Unknown

This stage represents kubernetes The cluster cannot get Pod Current state , Generally, it is because of network communication that we cannot communicate with Pod Work node communication

4.1.4.3.2     Pod The state of

One Pod It is divided into the following states :

Waiting

This state indicates Pod Waiting for other operations to complete Pod Normal start of , For example, pull the container image from the container image center to run locally 、 Perform some operations such as data encryption

Running

This state indicates Pod In normal operation , Can normally perform application business operations

Terminated

This state indicates Pod Has been successfully terminated , Application business operations have been stopped

( To be continued )

原网站

版权声明
本文为[uesowys]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207230430227686.html