2
The concept of cloud native is very popular recently, and the desire of enterprises to implement cloud native is also stronger. I have read a lot of articles about cloud native, either cloud and fog, or high and low. Therefore, the author has the idea of writing a series of articles "Dahua Cloud Native", hoping to explain the composition and application relationship in the Baiyun native ecosystem in the most popular and simple language. So, let's get started, this is the first one!

This is really an article about architecture technology, not a novel! I suggest you watch it!

1. Cooking dumplings on weekends talks about the container issue

I made dumplings with my wife on the weekend, "Husband, I'm going to buy a bottle of vinegar, you can cook the dumplings first." I was clumsy and prepared for a long time, and before I finished cooking, my wife came back. I looked at the pot of dumplings and asked, "Wife, how do you think this restaurant cooks dumplings? Everyone has different tastes and different appetites. Thinking about it gives me a headache!"

file

Xiao Na gestured with her hands and said, "Of course restaurants can't cook dumplings like they do at home. They have a special kind of pot, just like that."
I felt like I was married to a silly woman, "What is it like? Can you draw it with your hands? Have you seen the love apartment too much?". When my wife heard my complaint, she picked up her phone and searched: "No, that's what it looks like, you idiot!"

file

"The restaurant uses this kind of pot to cook dumplings. The water is a pot of water, and the stove is a stove. It is divided into multiple containers, and each container can be filled with dumplings ordered by a guest ." Xiaona, who is a little expert in life The students know a lot.
"Hey, let's go, isn't this just a server starting multiple docker containers ?" Xiaona, who is also a programmer, praised: "Husband, you are really right, I just watched docker recently, but I still don't know how to use it!".

Second, talk about docker and the container for cooking dumplings

"What docker do you learn as a front-end". Xiaona was not convinced, "Hey, don't look down on people, I still know k8s". This made me a little surprised. Just when I was in the accident, my wife almost made me squirt out: "What the hell is k8s?", we discussed that she would wash the dishes after dinner , and I told her about docker and k8 .

After a while, the after-dinner tutoring started: cooking dumplings in restaurants is a service (application service), the pot for cooking dumplings is like a server, and each mesh cage in the pot is like a docker container, usually a A mesh cage cooks only one type of dumpling, just like a docker container usually provides only one service (microservice). Necessary isolation can be performed between docker containers on the same server to avoid resource conflicts (dumplings with different fillings are cooked and mixed). It can fully share server resources (that pot of water and power supply) to achieve rational utilization of resources and avoid waste.

Xiaona smiled and nodded to indicate that she understood, "Then the scale of the hotel becomes larger and there are more and more customers, so you have to buy more cauldrons (servers)?"

file

Of course, you see, when there are more and more servers, a cluster is formed . Another benefit of docker containers is its standardization, where standardization represents deployment flexibility . If the No. 1 pot suddenly loses power, the dumpling master can pull out the container for cooking the dumplings and insert it into the No. 2 pot, because the standard of the container is the same. Just like docker containers can be started flexibly and quickly, and can be started on different servers to provide services.

Xiaona nodded again and cast an admiring look at me. Strike while the iron is hot, I concluded: "The docker container effectively realizes the standardization of the service environment encapsulation, as well as the environment isolation and resource sharing with the server container ".

3. Talk about cluster cooking dumplings (k8s)

Xiaona can't wait for the next content, "I understand docker, let's talk about k8s". I pretended to say, look, what problems still need to be solved in this restaurant's cluster container cooking dumpling model ? The two of us discussed it and came up with the following:

  • The customer flow of the restaurant is not always full, and the number of cauldrons must be purchased according to the maximum demand, but there must be some time when the cauldron is idle.
  • There must be a certain pattern of traffic flow, right? For example, there are more passengers on weekends than on weekdays, and more passengers after get off work than during working hours.
  • If a tourist group suddenly comes in for a meal, who will do emergency management? Quickly plug in the cauldron? Boil water? Satisfy dining needs?
  • If in order to avoid the taste confusion of the boiled dumplings, should the vegetarian fillings be cooked in different containers in a large pot? Would it be better to cook the meat stuffing together and the seafood stuffing together?
  • Does someone have to regularly check the "cauldron" and the containers in the cauldron for sanitation and operation status (health check)?
  • Does someone have to know clearly that the one or two dumplings with vegetarian filling belong to Tang Seng, and the four liang dumplings with meat filling belong to Zhu Bajie?

In fact, there are still many issues that need attention, all of which can be summarized as: task allocation or service orchestration, or container orchestration. The main function of k8s is to solve some problems like this:

  • Quickly expand and shrink the number of containers according to the size of the traffic.
  • Follow a certain predetermined plan to perform container orchestration, emergency management, and health checks
  • Properly orchestrate containers, some on CPU-intensive servers and some on memory-intensive containers. After all, some containers run computing microservices, and some containers run memory-consuming microservices. Reasonable arrangement can achieve the maximum utilization of resources.

The above and other issues of container management and orchestration all require k8s to manage and support, and it is automated support . Speaking of this, Xiaona thoughtfully said, "I heard it clearly, but I feel that this thing is so huge and complicated. Isn't it good to develop an application and deploy it together? Why is it so complicated?"

Not to mention, Xiaona really got the idea. But this can't be done all at once, otherwise who will wash the bowl tomorrow?

Welcome to my blog, more boutique knowledge collection

This article is reproduced to indicate the source (must be connected, not just text): Antetokounmpo blog-zimug.com


字母哥博客
933 声望1.5k 粉丝