A recent project used Kubernetes (k8S for short, with 8 letters between K and S). Although I have used k8S briefly before, recently I found that k8S has many concepts and commands are not enough, so I want to take this opportunity to write something to better understand and use K8S.Copy the code

The purpose of this article is to give you a fuller understanding of k8S concepts and to learn common operations at work. The whole thing is more about principle and application. Before officially starting K8S, we first take a look at the relationship between K8S and Docker, and describe why use container from the perspective of virtualization and deployment mode respectively.

At present, there is no article comparing the background and requirements of Kubernetes and Docker technology. This article starts from the perspective of the most pure official definition, and expounds the background of the two and the comparison with traditional technology.

Brief introduction:

Official definition 1: Docker is an open source application container engine, developers can package their applications and dependencies into a portable container, publish them on popular Linux machines, and also implement virtualization.

Official definition 2: K8S is an open-source container cluster management system. It can implement automatic deployment, capacity expansion, and maintenance of container clusters.

Comparison with traditional technology:

Let’s look at two classic pictures:

I. From the perspective of virtualization:

Figure 1

The image above shows how Docker containers, which can be managed by K8S, differ from traditional virtualization, which virtualizes physical hardware into multiple sets of hardware and then deploys an operating system on each of those sets of hardware, and then runs applications on those operating systems.

The Docker container application processes running directly on the host machine (real physical machine) on the kernel of Docker engine will some separate applications and their respective rely on packaging, independent run directly on the host machine hardware without virtualization, each container at the same time also does not have its own kernel, obviously lighter than the traditional virtual machines.

Search the backend architect of the public account to reply “clean architecture” and get a surprise gift package.

Each cluster has multiple nodes, and each node can be used. Our Kuberbete is born out of a small runtime environment (Container) that manages these applications.

Second, from the deployment perspective

Figure 2

Note that we should not confuse this picture with the Docker picture above. Figure 1 illustrates the virtualization operations needed to provide the necessary operating environment for applications from the perspective of virtualization (namely: traditional: virtual machines installed with operating system, Docker: containers under the management of container engine).

Figure 2 shows the actual application deployment on these specific operating environments. The traditional way is to deploy all applications directly on the same physical machine node, so that the dependency of each App is completely the same, and isolation between apps cannot be achieved. Of course, in order to isolate, We can also deploy apps to it by creating virtual machines (as shown in the top half of Figure 1), but this is too heavy, so Docker technology is more lightweight than virtual machines. Now we deploy applications by deploying Container technology, all containers run on the Container engine. If you want to use Docker, you can use it. How can you use it? Manually create one by one? Of course not, so Kubernetes technology will appear, to Kubernetes as a representative of the container cluster management system, this time the performance.

To put it bluntly, we use Kubernetes to manage Docker clusters, that is, Docker can be regarded as a low-level component used inside Kubernetes. In addition, Kubernetes supports not only Docker but also Rocket, another container technology. I hope my brief description in this article will give you some understanding of both.