current position:Home>The enmity between docker and k8s (VIII) -- suddenly looking back on kubernetes

The enmity between docker and k8s (VIII) -- suddenly looking back on kubernetes

2022-01-27 04:21:23 Grape City technical team

In the system, it introduces how to actually deploy a K8S After the project , As the last article in this series , Let's see Kubernetes Cluster content overview , Then summarize some deeper functions .


Kubernetes The overview

Here is a k8s Overview structure and content of


You can see that among the functional modules mentioned in the figure , There are others that do not appear in this article :

l  ConfigMap

Used to store user profile definitions , Through its internal Volume Projection technology implementation , Actually, too. Volume A way to mount . This method can not only realize the reuse of applications , Moreover, more flexible functions can be realized through different configurations . When creating a container , Users can package the application as a container image , Configuration injection is performed through environment variables or external mount files .


l  Secret

Secret Object types are used to hold sensitive information , For example, password 、OAuth Token and SSH secret key . Put this information in Secret Put the middle ratio in Pod The definition of 、 In the container image 、 be relative to ConfigMap Say safer and more flexible . Secret It's standard k8s Resource objects , Usage and ConfigMap Very similar . At the same time, we can Secret Access control , Prevent confidential data from being accessed

l  PV

PVC yes Kubernetes Implementation of persistent data volume in , It is StatefulSet Core functions , It's also Pod The necessary means of persistence ,Kubernetes adopt PV and PVC Split , So as to achieve the decoupling of function points .

In addition to what is mentioned in the text , Kubernetes The content of clusters is also much more complex than what we have seen so far , There is also a lot of content waiting for us to explore .

ad locum , Let's summarize these deep-seated functions , It's also a for in-depth learning Kubernetes The carding of .

Kubernetes Components

The server we usually use in the process of development ( Host machine ), stay Kubernetes The cluster is called Node node .

At the same time Kubernetes There is one or more Master The node controls multiple host computers to realize cluster , Whole Kubernetes The core scheduling functions of are basically Master Node .

Kubernetes Its main functions are composed of five major components :

  1. kubelet: Installed in the Node Node , To control Node The container in the node is complete Kubernetes The scheduling logic of
  2. ControllerManager: It is the core management component of the controller mode we mentioned above , Managed everything Kubernetes Controller logic in the cluster
  3. API Server: The service handles the... In the cluster api request , We've been writing kubectl, It's actually sent to API Server Request , Requests are processed and forwarded internally
  4. Scheduler: be responsible for Kubernetes Service scheduling , For example, the controller just controls Pod Arrangement of , The final scheduling logic is composed of Scheduler Completed and sent a request to kubelet Executive
  5. Etcd: This is a distributed database storage project , from CoreOS Development , Was eventually RedHat Acquisition becomes Kubernetes Part of , It contains Kubernetes All configuration information in the cluster , For example, all cluster objects name,IP,secret,configMap And so on , Relying on its own consistency algorithm, it can ensure the rapid and stable return of various configuration information in the system , So this is also Kubernetes And the core components in your heart

Customized functions

In addition to various powerful component functions ,Kubernetes It also provides users with a very high degree of freedom .

In order to achieve this high degree of freedom ,Kubernetes Three open interfaces are provided to users , Namely :

l  CNI(Container Networking Interface, Container network interface ): It is defined. Kubernetes The link mode of all networks in the cluster , The network of the whole cluster is realized through this interface . As long as the network plug-in realizes all functions in this interface , Can be used as Kubernetes Network configuration plug-in for cluster , It includes the host routing table configuration 、7 Layer network discovery 、 Packet forwarding and so on have all kinds of small plug-ins , These small plug-ins can also be used together at will , Users can customize these functions freely according to their own needs

l  CSI(Container Storage Interface, Container storage interface ) Defines some specifications for cluster persistence , As long as the storage function of this interface is implemented , Can be used as Kubernetes Persistence plug-ins l  CRI(Container Runtime Interface, Container runtime interface ): stay Kubernetes When the container is running , For example, the default configuration Docker When the container of this cluster runs , Users are free to choose any other container project that implements this interface , Like I mentioned before containerd and rkt

Here's an interesting point :CRI.

Kubernetes The default container for is Docker, However, due to the competition in the early stage of the project ,Docker It's not enough Kubernetes Defined by the CRI standard , Then what shall I do? ?

To solve this problem ,Kubernetes Specially for Docker Wrote a program called DockerShim The components of , namely Docker shim , Used to handle CRI Request specification , Convert into Docker operation Linux Of OCI standard ( Yes , It's the one mentioned in the second part OCI The foundation's code ). But this function has always been by Kubernetes Project maintenance , as long as Docker New features have been released Kubernetes We have to maintain this DockerShim Components .

therefore , This recent news ——Kubernetes Will be in next year's version v1.20 Delete... From DockerShim Components , It means starting with the new version next year ,Kubernetes Will not fully support Docker Container update .

But in fact, this may not have any impact on our ordinary developers , The worst result is that our image needs to be from Docker Change to something else Kubernetes Supported container images .

However, according to the news released by various cloud platforms during this period , These platforms will provide corresponding conversion measures , For example, we still provide Docker Mirror image , The platform will convert these images into other images when publishing operation and maintenance ; Or these platforms will maintain a DockerShim To support Docker, There are solutions .

Architecture Overview and summary

In this part, let's take a look at Kubernetes The architecture of the figure :


Through this series of learning , As an ordinary programmer , Have to admire Google Have a deep and extreme understanding of coding , There are too many components in the framework just because of decoupling , And it also provides such a large degree of freedom , It has to be said that it is a framework with great technical depth encountered by our movable type development team in the process of learning .

But this high degree of freedom also has negative effects .

During deployment ,Kubernetes Cluster complexity is very high , Deploy a to meet the needs of the production environment Kubernetes The framework is even more difficult , There are also special sellers on the Internet Kubernetes Script program for cluster deployment in production environment , so Kubernetes The scale of the system .

In the process of learning, you can use kinD perhaps minikube In local with Docker In the form of a Kubernetes colony , However, there is still a certain gap between this level of learning and the production environment .


This series of articles , It describes in detail several difficult gods encountered by our movable type lattice development team in the process of going to heaven .

From the development of cloud platform to k8s Specific use of , Step by step, I explained a cloud platform , From the original virtual machine , To PaaS embryonic form , To Docker Containerization , And finally Kubernetes The transition and evolution of the form of .

Human memory needs to rely on precursor nodes , Just through an article, I want to put Kubernetes It is obviously impossible to explain the technical points and various difficult to remember nouns one by one , Our idea is to let everyone understand the evolution process of the whole cloud ecology step by step , So as to finally understand the whole project .

Finally, I want to give you a word :

It's on paper , We must know that we must do it .

After our development team members read these documents for the first time, they feel that they have completely mastered , But in the actual document writing process , I found that my eyes were black , I don't know where to start .

Too many knowledge points only stay in heard of , Just know what stage it is . I suggest you start here , Try the examples mentioned in the article , We believe that after writing it ourselves , You will have a different understanding of these contents .

Although this series is over , However, in the follow-up content, we will continue to tell you more about various technical secrets encountered by new and old grapes in the grape city 、 Share .


I think the content is good. Give me a compliment before you go ~

Reprint please indicate the source : Grape city official website , Grape city provides professional development tools for developers 、 Solutions and services , Enabling developers .

copyright notice
author[Grape City technical team],Please bring the original link to reprint, thank you.

Random recommended