[k8s study notes-Introduction to container concepts (5)-A brief look at the essence of K8S]

From containers to container cloud

Container composition

A "container" is actually a process isolation environment built by three technologies: Linux Namespace, Linux Cgroups and rootfs.

container structure

  1. A set of rootfs jointly mounted on /var/lib/docker/aufs/mnt. This part is called the "Container Image" and is a static view of the container;
  2. An isolation environment composed of Namespace+Cgroups. This part is called the "Container Runtime" and is a dynamic view of the container.

Which part do developers care about?

Developers care about static views. As a developer, I don't care about the differences in container runtimes. Because, in the entire "development-testing-release" process, it is the container image, not the container runtime, that actually carries the container information.

Through container images, you can directly connect with potential users (that is, developers) .

Containers are the absolute protagonist in cloud computing

The "container orchestration" technology that can define container organization and management specifications has taken the "top spot" in the field of container technology.

Among them, the most representative container orchestration tools are Docker's Compose+Swarm combination and the Kubernetes project jointly led by Google and RedHat.

What problem does K8S solve?

K8S architecture

Divided into control nodes and computing nodes:

  • Control node, master node: consists of three components, namely kube-apiserver responsible for API services, kube-scheduler responsible for scheduling, and kube-controller-manager responsible for container orchestration. The persistent data of the entire cluster is processed by kube-apiserver and stored in Etcd.
  • Compute node: The core component kubelet’s important function is to interact with the container runtime. The interaction relies on CRI , the remote call interface. This interface defines the core operations of the container runtime, such as all the parameters required to start a container. The second important function is to call the network plug-in and storage plug-in to configure the network and persistent storage for the container.

Important solution ideas

  • There are actually various relationships between various tasks running in large-scale clusters. The processing of these relationships is the most difficult part of the job arrangement relationship system. For example, the access relationship between applications and databases, and the agency relationship between load balancing and back-end servers.
  • K8S design philosophy : From a more macro perspective, define various relationships between tasks in a unified way, leaving room to support more types of relationships in the future.
  • Previous approach : Before the popularity of container technology, the traditional virtual machine environment handled this relationship in a very coarse-grained manner, and unrelated application functions were deployed in the same virtual machine all at once, just because of a few occasional requests. And it also requires a variety of manual maintenance work.
  • The fine-grained advantage of containers : Each application function, component, and daemon process that was originally crowded in the same virtual machine is individually mirrored and then runs in a dedicated container.
  • Unlike other projects, there is no need to write an instruction for each management function and then implement it in the project. This approach will be insufficient when facing more problems.

K8S approach

  • First, an "orchestration object" is returned to you, such as job, pod, etc. to describe the managed application.
  • Then, define some service objects for it, such as service\secres, etc. These objects will serve specific platform functions.
  • The above method is the so-called declarative API . The orchestration objects and service objects corresponding to this API are the API objects in the K8S project. API Object.

Scheduling and orchestration

  • A container or POD is placed on an optimal node to run according to certain rules. This function is called " scheduling "
  • The relationship between containers is not fully automated and handled according to the user's wishes and the rules of the entire system. This function is " orchestration "

Summarize

  • Containers can be divided into two parts, container runtime and container image
  • K8S project architecture
  • How to use declarative API to describe the design ideas of containerized business and development relationships

Guess you like

Origin blog.csdn.net/Amelie123/article/details/126328620