[Cloud Native Kubernetes] Basic Concepts of Kubernetes


1. What is Kubernetes

image-20221022151133033

We urgently need a large-scale container orchestration system

Kubernetes has the following characteristics:

  • Service Discovery and Load Balancing
    Kubernetes can expose containers using DNS names or their own IP addresses, and if there is a lot of traffic coming into containers, Kubernetes can load balance and distribute network traffic, making deployments stable.
  • Storage Orchestration
    Kubernetes allows you to automatically mount the storage system of your choice, such as on-premises storage, public cloud providers, etc.
  • Automated Deployment and Rollback
    You can use Kubernetes to describe the desired state of a deployed container, which can change the actual state to the desired state at a controlled rate. For example, you can automate Kubernetes to create new containers for your deployment, delete existing containers and use all their resources for new containers.
  • Automatically complete box packing
    Kubernetes allows you to specify the CPU and memory (RAM) required for each container. When a container specifies a resource request, Kubernetes can make better decisions about managing the container's resources.
  • Self-healing
    Kubernetes restarts failed containers, replaces containers, kills containers that do not respond to user-defined health checks, and does not notify clients of them until they are ready for service.
  • Key and Configuration Management
    Kubernetes allows you to store and manage sensitive information such as passwords, OAuth tokens, and ssh keys. You can deploy and update secrets and application configurations without rebuilding container images, or exposing secrets in stack configurations.

Kubernetes gives you a framework for running distributed systems elastically. Kubernetes takes care of your scaling requirements, failover, deployment patterns, and more. For example, Kubernetes makes it easy to manage canary deployments of the system.

2. Architecture

2.1 Working method

Kubernetes Cluster = N Master Node + N Worker Node: N Master Node + N Worker Node; N>=1

2.2 Component Architecture

image-20221022151441608

2.2.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 (such as launching new pods when replicasfields ).

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. See Building a Highly Available Cluster with kubeadm for an example of a multi-VM control plane setup.

to apiserver

The API server is the component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end of the Kubernetes control plane.

The primary implementation of the Kubernetes API server is kube-apiserver . kube-apiserver is designed to scale horizontally, that is, it scales by deploying multiple instances. You can run multiple instances of kube-apiserver and balance traffic between these instances.

etcd

etcd is a key-value database with consistency and high availability, which can be used as the background database for storing all Kubernetes cluster data.

The etcd database of your Kubernetes cluster usually needs to have a backup plan.

For in-depth information on etcd, please refer to the etcd documentation .

kube-scheduler

The control plane component is responsible for monitoring newly created Pods that do not specify a running node (node) , and selects a node for the Pod to run on.

Factors considered in scheduling decisions include resource requirements of individual Pods and collections of Pods, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, interference among workloads, and deadlines.

kube-controller-manager

Components that run the controller .

Logically, each controller is a separate process, but to reduce complexity, they are all compiled into the same executable and run in one process.

These controllers include:

  • Node Controller: Responsible for notification and response when a node fails
  • Job controller: monitors Job objects representing one-off tasks, then creates Pods to run those tasks to completion
  • Endpoints Controller: Populate the Endpoints object (that is, add Service and Pod)
  • Service Account & Token Controllers: Create default accounts and API access tokens for new namespaces
cloud-controller-manager

A cloud controller manager refers to a control plane component that embeds the control logic for a particular cloud. Cloud Controller Manager allows you to link clusters to cloud provider APIs and separate components that interact with that cloud platform from components that only interact with your cluster.

cloud-controller-managerOnly run control loops specific to the cloud platform. If you are running Kubernetes in your own environment, or running the learning environment on your local machine, you do not need Cloud Controller Manager in your deployed environment.

kube-controller-managerSimilar to , cloud-controller-managerseveral logically independent control loops are combined into the same executable file for you to run as the same process. You can scale it horizontally (run more than one replica) to improve performance or increase fault tolerance.

The following controllers all contain dependencies on cloud platform drivers:

  • Node Controller: used to check the cloud provider to determine whether the node has been deleted after the node terminates the response
  • Route Controller: used to set up routing in the underlying cloud infrastructure
  • Service Controller: used to create, update and delete cloud provider load balancers

2.2.2 Node components

The node component runs on each node, maintains running pods and provides the Kubernetes runtime environment.

Kubelet

A proxy that runs on each node in the cluster . It ensures that all containers are running in Pods .

The kubelet receives a set of PodSpecs provided to it through various mechanisms, and ensures that the containers described in these PodSpecs are running and healthy. The kubelet will not manage containers not created by Kubernetes.

be a proxy

kube-proxy is a network proxy running on each node in the cluster, which implements part of the Kubernetes service (Service) concept.

kube-proxy maintains network rules on nodes. These network rules allow network communication with pods from network sessions inside or outside the cluster.

/en/docs/concepts/services-networking/service/) Concepts.

kube-proxy maintains network rules on nodes. These network rules allow network communication with pods from network sessions inside or outside the cluster.

If the operating system provides a packet filtering layer and is available, kube-proxy will implement network rules through it. Otherwise, kube-proxy only forwards the traffic itself.

Supongo que te gusta

Origin blog.csdn.net/CSDN_anhl/article/details/127537756
Recomendado
Clasificación