Home  >  Article  >  Operation and Maintenance  >  What is the difference between k8s and docker?

What is the difference between k8s and docker?

青灯夜游
青灯夜游Original
2020-10-23 16:26:434770browse

Difference: k8s is an open source container cluster management system, which can realize automatic deployment, automatic expansion and contraction, maintenance and other functions of container clusters; Docker is an open source application container engine, developers can package their Applications and dependencies are put into a portable container and distributed to popular Linux machines, which can also be virtualized.

What is the difference between k8s and docker?

(Recommended tutorial: docker tutorial)

The difference and introduction of Docker and k8s

In 2010, several young people engaged in IT established a company called "dotCloud" in San Francisco, USA.

This company mainly provides cloud computing technology services based on PaaS. Specifically, it is the container technology related to LXC.

LXC is Linux container virtualization technology (Linux container)

Later, dotCloud simplified and standardized its container technology and named it ——Docker.

#After the birth of Docker technology, it did not attract the attention of the industry. As a small startup, dotCloud is also struggling under fierce competition.

Just when they were about to lose it, the idea of ​​"open source" popped into their minds.

What is "open source"? Open source means open source code. That is to say, the original internally confidential program source code is open to everyone, and then everyone can participate and contribute code and opinions.

Open Source, open source

Some software is open source from the beginning. There are also some software that cannot be mixed, and the creators don’t want to give up, so they choose to open source. If you can't support yourself, just eat "hundreds of families' food".

In March 2013, 28-year-old Solomon Hykes, one of the founders of dotCloud and the father of Docker, officially decided to open source the Docker project.

Solomon Hykes (just resigned from Docker this year)

It’s nothing if you don’t open it, but it’s amazing once you open it.

More and more IT engineers have discovered the advantages of Docker, and then flocked to join the Docker open source community.

Docker’s popularity is rising rapidly, and the speed is jaw-dropping.

In the month of open source, Docker version 0.1 was released. Every month since then, Docker will release a version. By June 9, 2014, Docker version 1.0 was officially released.

At this time, Docker has become one of the most popular open source technologies in the industry. Even giants like Google, Microsoft, Amazon, and VMware favor it and express their full support.

After Docker became popular, dotCloud simply changed the company name to Docker Inc.

Why are Docker and container technology so popular? To put it bluntly, it is because it is "light".

Before container technology, the most popular Internet celebrity in the industry was virtual machines. Virtual machine The representatives of technology are VMWare and OpenStack.

I believe many people have used virtual machines. A virtual machine is to install a software in your operating system, and then use this software to simulate one or even multiple "sub-computers".

Virtual machine, similar to a "subcomputer"

In the "subcomputer", you can run programs like a normal computer, such as opening QQ. If you want, you can create several "sub-computers" with QQ running on them. "Sub-computer" and "sub-computer" are isolated from each other and do not affect each other.

Virtual machines belong to virtualization technology. Container technology such as Docker is also a virtualization technology and belongs to lightweight virtualization.

Although a virtual machine can isolate many "subcomputers", it takes up more space, starts slower, and the virtual machine software may cost money (such as VMWare).

Container technology does not have these shortcomings. It does not need to virtualize the entire operating system, but only needs to virtualize a small-scale environment (similar to a "sandbox").

Sandbox

It starts up quickly and can be completed in a few seconds. Moreover, it is highly resource efficient (one host can run thousands of Docker containers simultaneously). In addition, it takes up very little space. Virtual machines generally require several to dozens of GB of space, while containers only require MB or even KB.

Comparison between containers and virtual machines

Because of this, container technology has been warmly welcomed and sought after, and is developing rapidly.

Let’s take a look at Docker in detail.

Everyone needs to note that Docker itself is not a container, it is a tool for creating containers and an application container engine.

If you want to understand Docker, just read its two slogans.

The first sentence is "Build, Ship and Run".

That is, "build, send, run", three things.

For example:

I came to a vacant lot and wanted to build a house, so I moved stones, chopped wood, drew drawings, and finally built the house.

# As a result, I lived there for a while and wanted to move to another open space. At this time, according to the previous methods, I can only move stones, chop wood, draw drawings, and build houses again.

However, an old witch came and taught me a magic.

This kind of magic can make a copy of the house I built, make it a "mirror image", and put it in my backpack.

When I get to another open space, I will use this "mirror image" to copy a house, place it there, and move in with my bags.

How about it? Isn't it amazing?

So, the second slogan of Docker is: "Build once, Run anywhere (Build once, run anywhere)".

The three core concepts of Docker technology are:

  • Image
  • Container
  • Repository

In my example just now, the "mirror" placed in the package is the Docker image. And my backpack is Docker warehouse. The house I built using magic is a Docker container in the open space.

To put it bluntly, this Docker image is a special file system. In addition to providing the programs, libraries, resources, configuration and other files required for container runtime, it also contains some configuration parameters (such as environment variables) prepared for runtime. The image does not contain any dynamic data, and its content will not be changed after it is built.

In other words, every time the house is transformed, the house is the same, but daily necessities and the like are ignored. Whoever lives in the property is responsible for the purchase.

Each mirror image can create a kind of house. Then, I can have multiple mirrors!

In other words, I built a European-style villa and generated a mirror image. Another buddy may have built a Chinese courtyard house and also generated a mirror image. There is also a buddy who built an African thatched house and also generated a mirror image. . .

In this way, we can exchange images. You use mine and I use yours. Isn’t it great?

So it became a large public warehouse.

The one responsible for managing Docker images is the Docker Registry service (similar to a warehouse administrator).

Not any mirror built by anyone is legal. What if someone built a house with problems?

So, the Docker Registry service is very strict about image management.

The most commonly used Registry public service is the official Docker Hub, which is also the default Registry and has a large number of high-quality official images.

Okay, after talking about Docker, let’s turn our attention to K8S.

Just when Docker container technology was being hyped up, everyone found that it was difficult to apply Docker to specific business implementations-arrangement, management, and scheduling were all difficult. easy. Therefore, people urgently need a management system to provide more advanced and flexible management of Docker and containers.

At this time, K8S appeared.

K8S is a container-based cluster management platform. Its full name is kubernetes.

The word Kubernetes comes from Greek, meaning helmsman or navigator. K8S is its abbreviation, using the word "8" to replace the 8 characters of "ubernete".

Unlike Docker, the creator of K8S is a well-known industry giant-Google.

However, K8S is not a brand new invention. Its predecessor is the Borg system that Google has been tinkering with for more than ten years.

K8S was officially announced and open sourced by Google in June 2014.

In July of the same year, companies such as Microsoft, Red Hat, IBM, Docker, CoreOS, Mesosphere and Saltstack successively joined K8S.

Within the next year, companies such as VMware, HP, and Intel also joined one after another.

In July 2015, Google officially joined the OpenStack Foundation. At the same time, Kuberentes v1.0 was officially released.

Currently, the version of kubernetes has developed to V1.13.

The architecture of K8S is a little complicated, let’s take a brief look at it.

A K8S system is usually called a K8S cluster (Cluster).

This cluster mainly consists of two parts:

  • A Master node (master node)
  • A group of Node nodes (computing Node)

You can understand at a glance: the Master node is mainly responsible for management and control. Node is a workload node, which contains specific containers.

Let’s take a closer look at these two nodes.

The first is the Master node.

Master node includes API Server, Scheduler, Controller manager, etcd.

API Server is the external interface of the entire system for clients and other components to call, which is equivalent to the "business hall".

Scheduler is responsible for scheduling resources within the cluster, which is equivalent to the "scheduling room".

Controller manager is responsible for managing the controller, which is equivalent to the "general manager".

Then Node node.

Node nodes include Docker, kubelet, kube-proxy, Fluentd, kube-dns (optional), and Pod.

Pod is the most basic operating unit of Kubernetes. A Pod represents a process running in the cluster, and it encapsulates one or more closely related containers. In addition to Pod, K8S also has the concept of Service. A Service can be regarded as the external access interface of a group of Pods that provide the same service. This paragraph is not easy to understand, so skip it.

Docker, needless to say, creates containers.

Kubelet is mainly responsible for monitoring the Pod assigned to the Node where it is located, including creation, modification, monitoring, deletion, etc.

Kube-proxy is mainly responsible for providing a proxy for Pod objects.

Fluentd is mainly responsible for log collection, storage and query.

Are you a little confused? Alas, it’s really hard to explain clearly in a few words, so just keep skipping.

Docker and K8S have been introduced, but the article is not over yet.

The following part is written for core network engineers and even all communication engineers.

From 1G decades ago, to 4G now, and to 5G in the future, mobile communications have undergone earth-shaking changes, and so has the core network.

However, if you take a closer look at these changes, you will find that the so-called core network has not actually changed in essence, it is nothing more than a lot of servers. Different core network elements are different servers and different computing nodes.

What has changed is the form and interface of these "servers": the form has changed from cabinet single boards to cabinet blades, and from cabinet blades to X86 universal blade servers; the interfaces have changed from trunk cables to Network cable, from network cable to optical fiber.

Even if it changes, it is still a server, a computing node, and a CPU.

Since it is a server, it is bound to embark on the path of virtualization like IT cloud computing. After all, virtualization has too many advantages, such as low cost, high utilization, full flexibility, dynamic scheduling, etc. mentioned above.

In the past few years, everyone thought that virtual machines were the ultimate form of core networks. At present, it seems that it is more likely to be containerization. NFV (Network Element Function Virtualization), which is often mentioned in recent years, may also be renamed NFC (Network Element Function Containerization).

Take VoLTE as an example. If you follow the previous 2G/3G method, a large number of dedicated equipment will be needed to serve as different network elements of EPC and IMS.

VoLTE related network elements

After using containers, it is likely that you only need one server and create a dozen containers, using different containers. to run service programs of different network elements respectively.

These containers can be created and destroyed at any time. It can also be arbitrarily larger, arbitrarily smaller, arbitrarily stronger, arbitrarily weaker without stopping, achieving a dynamic balance between performance and power consumption.

Simply perfect!

In the 5G era, the core network adopts a microservice architecture, which is also perfectly matched with containers - a monolithic architecture (Monolithic) becomes a microservices architecture (Microservices), which is equivalent to an all-rounder becoming N specialized ones. type. Each specialist is assigned to an isolated container, giving maximum flexibility.

Fine division of labor

According to this development trend, in the mobile communication system, except for the antenna, the remaining parts may be virtualized. The core network is the first, but not the last. The core network after virtualization should actually be classified as IT rather than communications. The function of the core network is just an ordinary software function in the container.

As for all the core network engineers here, congratulations, your transformation will be successful soon!

The above is the detailed content of What is the difference between k8s and docker?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn