Full of dry goods! 10 minutes to understand Docker and K8S

Full of dry goods! 10 minutes to understand Docker and K8S

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

最后更新 8/15/2023 9:49 PM
多多宜睡
预计阅读 13 分钟
分类
Docker
标签
Docker

This article comes from WeChat: Fresh Date Classroom

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 container technology related to LXC.

LXC is Linux container virtualization technology

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

After Docker technology was born, it did not attract the attention of the industry. And dotCloud, as a small start-up company, is also struggling under fierce competition.

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

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

Open Source,开源

Some software was open source from the beginning. There are also some software that can't survive, but the creator doesn't want to give up, so he chooses open source. If you can't support yourself, just eat "hundreds of rice".

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(今年刚从 Docker 离职)

If you don't open it, you will be done, but if you open it, you will be amazing.

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

Docker's popularity has grown rapidly, and the speed is staggering.

In the month of open source, Docker version 0.1 was released. Docker releases a version every month since then. As of 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".

在容器技术之前,业界的网红是虚拟机。虚拟机技术的代表,是 VMWareOpenStack

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

Virtual machines, similar to "sub-computers"

在 “子电脑” 里,你可以和正常电脑一样运行程序,例如开 QQ。如果你愿意,你可以变出好几个 “子电脑”,里面都开上 QQ。“子电脑” 和 “子电脑” 之间,是相互隔离的,互不影响。

虚拟机属于虚拟化技术。而 Docker 这样的容器技术,也是虚拟化技术,属于轻量级的虚拟化

Although virtual machines can isolate many "sub-computers", they take up more space and start up slower, and virtual machine software may cost money (such as VMWare).

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

沙箱

It takes a quick start time and can be completed in a few seconds. Moreover, it makes a high utilization of resources (a host can run thousands of Docker containers simultaneously). In addition, it takes up very little space. Virtual machines generally require a few gigabytes to tens of gigabytes of space, while containers only require MB or even KB levels.

容器和虚拟机的对比

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

Let's take a look at Docker specifically.

大家需要注意,Docker 本身并不是容器,它是创建容器的工具,是应用容器引擎。

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

第一句,是 “Build, Ship and Run”

In other words,"build, send, and run" are three axes.

An example:

I came to an open space and wanted to build a house, so I moved stones, cut wood, drew drawings, and finally built the house after a lot of operations.

As a result, I lived there for a while and wanted to move to another vacant lot. At this time, according to the previous method, I could only move stones, cut wood, draw drawings, and build a house again.

But 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 arrived at another open space, I used this "mirror image" to replicate a house, placed it over there, and moved in with my bag.

How is it? Isn't it amazing?

所以,Docker 的第二句口号就是:“Build once,Run anywhere(搭建一次,到处能用)”

The three core concepts of Docker technology are:

  • Image
  • Container
  • Warehouse (Repository)

我刚才例子里面,那个放在包里的 “镜像”,就是 Docker 镜像。而我的背包,就是 Docker 仓库。我在空地上,用魔法造好的房子,就是一个 Docker 容器。

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

In other words, every time a house is created, the house will be the same, but daily necessities will not be cared, and whoever lives will be responsible for purchasing it.

Each mirror image can create a house. So, I can have multiple mirror images!

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

In this way, we can exchange mirror images. You use mine and I use yours. Wouldn't it be great?

As a result, it became a large public warehouse.

负责对 Docker 镜像进行管理的,是 Docker Registry 服务(类似仓库管理员)。

Not every mirror image created by anyone is legal. What if someone builds a house that's in trouble?

Therefore, the Docker Registry service manages images very strictly.

最常使用的 Registry 公开服务,是官方的 Docker Hub,这也是默认的 Registry,并拥有大量的高质量的官方镜像。

Okay, after talking Docker, we turn our attention to K8S.

Just as Docker container technology was in full swing, everyone found that it was difficult to apply Docker to specific business implementations-it was not easy to organize, manage, and schedule. Therefore, people urgently need a management system to manage Docker and containers more advanced and flexible.

At this time, K8S appeared.

K8S,就是基于容器的集群管理平台,它的全称,是 kubernetes。

The word Kubernetes comes from the Greek and means helmsman or navigator. K8S is its abbreviation, replacing the eight characters of "ubernete" with the word "8".

和 Docker 不同,K8S 的创造者,是众人皆知的行业巨头 ——Google

然而,K8S 并不是一件全新的发明。它的前身,是 Google 自己捣鼓了十多年的 Borg 系统

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

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

In the following year, VMware, HP, Intel and other companies also joined.

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 slightly complicated. Let's take a brief look.

一个 K8S 系统,通常称为一个 K8S 集群(Cluster)

This cluster mainly consists of two parts:

  • One Master node (master node)
  • A group of Node nodes (compute nodes)

It can be understood at a glance that the Master node is mainly responsible for management and control. A Node node is a workload node with specific containers inside.

Take an in-depth look at these two nodes.

首先是 Master 节点

Master nodes include API Server, Scheduler, Controller manager, etcd.

  • API Server is the external interface of the entire system and is called by clients and other components. It is equivalent to a "business hall".
  • The Scheduler is responsible for scheduling resources within the cluster, which is equivalent to a "scheduling room".
  • Controller manager is responsible for managing the controller and is equivalent to the "big manager".

然后是 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 a cluster that encapsulates one or more closely related containers within it. In addition to Pods, K8S also has the concept of Service. A Service can be regarded as an external access interface for a set 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 Pods assigned to its Node, including creation, modification, monitoring, deletion, etc.
  • Kube-proxy is mainly responsible for providing proxy for Pod objects.
  • Fluentd is mainly responsible for log collection, storage and query.

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

Docker and K8S have been introduced, but the article does not end.

接下来的部分,是写给核心网工程师甚至所有通信工程师看的

From 1G decades ago, to 4G today, and then to 5G in the future, mobile communications have undergone earth-shaking changes, as 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 changed in essence. It is just 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 interface has changed from trunk cables to network cables, and from network cables to optical fibers.

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 the low cost, high utilization, full flexibility, dynamic scheduling, etc. mentioned earlier.

前几年,大家以为虚拟机是核心网的终极形态。目前看来,更有可能是容器化。这几年经常说的 NFV(网元功能虚拟化),也有可能改口为 NFC(网元功能容器化)。

Taking VoLTE as an example, if the previous 2G/3G approach is followed, a large number of dedicated equipment will be required to serve as different network elements of EPC and IMS respectively.

VoLTE-related network elements

After adopting containers, it is very likely that only one server will be needed, more than a dozen containers will be created, and different containers will be used to run service programs for different network elements.

These containers can be created or destroyed at any time. It can also become larger, smaller, stronger, and weaker at will without stopping the machine, dynamically balancing performance and power consumption.

It's perfect!

In the 5G era, the core network adopts a micro-service architecture, which is also perfectly matched with containers-a Monolithic architecture becomes a Microservices architecture, which is equivalent to one all-round model becoming N specialized models. Each specialized type is assigned to an isolated container, giving maximum flexibility.

fine division of labor

According to this development trend, in mobile communication systems, except for antennas, all 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. The function of the core network is just an ordinary software function in the container.

As for all the core network engineers present here, congratulations, you are about to successfully transform!

Keep Exploring

延伸阅读

更多文章
同标签 2/25/2025

NET 10 Preview 1 released

Today. NET 10 Preview 1 was released. I downloaded it as soon as possible and upgraded the Avalonia UI project and blog site. The former's functional testing and AOT release were normal, the latter's debugging was normal, and Docker was not successful for the time being.

继续阅读