In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Preface
The first time I came into contact with Kubernetes was in 2016. When I read the blog again, it was the first time I heard the term Kubernetes and the first time I knew such a thing as K8s. Later, when I slowly learned about it, I was attracted by its design concept of natural high availability, load balancing, flexible computing, automatic capacity expansion and reduction, and automatic disaster recovery mechanism, so I stepped into the road of no return of k8s, and in the process of research and learning, began to fill holes, dig holes and fill holes again and again.
In 2017, the company is still using naked Docker to deploy some stateless applications. With more and more Docker instances, manually filling holes in the event of failure gives us a real headache. Sometimes when we are having a dream in the middle of the night, we are called up by a phone to deal with all kinds of problems caused by host computer downtime or network unreachability. This terrible way of dealing with it gives us an even more unbearable headache. Although we later cited Swarm and Compose, with the continuous growth of business, it has become more and more unable to meet our application scenarios, and then we want to migrate all Docker applications to Kubernetes to manage.
On June 30th, 2017, K8S released version 1.7. in October 2017, Docker embraced Kubernetes, which was the beginning of our official use of Kubernetes. But things are not as simple as we thought, the design of K8s is too complicated, the concept is too many, the construction process is more people vomiting blood, and there are very few articles available for reference at that time. After more than a month of research and continuous blood recovery, we finally deployed our first application in the k8s cluster. Although we stepped on numerous pits and encountered numerous problems in the whole process, we did not give up from the beginning to the end, and finally realized a complete set of process design, from the development and submission of code to Git, and finally successfully deployed to the K8s cluster, completely releasing our hands. When the host in the cluster goes down, you don't have to deal with it manually. All these K8s help you deal with it silently.
2. The changes brought about by Kubernetes
For developers
Because the company has a lot of business, the development environment, test environment, pre-production environment and production environment are all isolated, and in addition to the production environment, in order to save costs, there is no log collection in other environments. When k8s is not used, to view the log of offline testing, developers or testers are needed to find the corresponding machine, find the corresponding container, and then check the log. Developers and tests can directly locate the business container in the dashboard of K8s to the corresponding namespace, and then view the corresponding logs directly through the console, which greatly reduces the operation time.
After the application is deployed to K8s, code release, rollback, blue-green release, canary release and so on become particularly simple, which not only speeds up the iteration of business code, but also does not require human intervention. At present, we use jenkins and gitrunner for distribution or rollback, from the development environment to the test environment to the final production environment, fully complying with one-time build, multi-cluster, multi-environment deployment, and distinguishing different environments through different startup parameters, different environment variables, and different configuration files. At present, it has realized one-click release and one-click rollback in Python, Java, PHP, NodeJS, Go, .NET Core and other languages, which has greatly improved the development efficiency of developers.
After using the service grid, developers no longer have to care about the network part of the code in the process of developing the application, these functions are implemented by the service grid, so that developers can only care about the logical part of the code, and then realize the functions of the network part, such as: cut-off, shunt, routing, load balancing, speed limit and trigger failure and other functions.
During the testing process, there may be multiple environments at the same time, of course, you also need to create another test environment. Before the creation of the test environment, you need to find OPS or build it by hand. After migrating to the K8s cluster, you only need to click on the jenkins to create a new test environment on the K8s cluster.
For operation and maintenance personnel
If you are an operation and maintenance staff, you may often get tired of repetitive and tedious work. For example: this requires a new test environment, that requires a new test environment, may need to install the system, install dependent environment, open permissions, and so on. Today, a new test environment can be deployed directly with images, even without self-intervention. Developers can create it with one click through jenkins or automated operation and maintenance platform, which greatly reduces the cost of operation and maintenance.
At the beginning, the company's business failure may be due to problems such as inconsistent basic environment, inconsistent dependencies, port conflicts, and so on. Now, with the implementation of mirror deployment, all dependencies and foundations are the same, which greatly reduces the number of failures caused by such basic problems. It is also possible that the service is unavailable due to server outage, network and other problems, which need to be repaired by operation and maintenance personnel in a timely manner. Now, K8s may have helped you recover when you received the alarm message.
When k8s is not used, the expansion and reduction of business applications need to be handled manually. From purchasing servers, putting them on shelves, and deploying dependent environments, it not only requires a lot of manpower and material resources, but also is very easy to cause problems in the intermediate process. It takes a lot of time to find the problem. After being successfully put on the shelf, you also need to add or the server at the reverse end of the front end. Now, you can use the elastic computing of K8s to expand and reduce capacity with one click, which not only greatly improves the efficiency of operation and maintenance, but also saves a lot of server resources and improves the utilization of resources.
For reverse configuration, for example, you may not know or are not familiar with the configuration rules of nginx, and you can't implement some advanced functions, but now you can easily implement responsible logic with K8s ingress. And you won't encounter the problem of adding one less slash and one more slash in nginx.
In terms of load balancing, the previous load balancers may be Nginx, LVS, HAProxy, F5, etc., and the cloud service provider may provide an out-of-place balancing mechanism. Every time you add or delete nodes, you need to manually configure the front-end load balancer and match the back-end nodes manually. Now, you can dynamically discover and automatically manage nodes by using service in K8s, and support automatic capacity expansion and reduction. In the past, when we encountered peak traffic, the performance of the server was often not enough, so we need to temporarily add the server to face the peak traffic, but now for the high-performance K8s cluster, there is no need to manage and automatically expand the capacity.
For high availability, k8s has a natural high availability feature that completely releases your hands, eliminating the need to create all kinds of high availability tools and check scripts. K8s supports process-level health check. If you find that the interface times out or the returned value is incorrect, the problem will be handled automatically.
For the construction of middleware, according to the defined deploy file, we can build all kinds of highly available middleware clusters in seconds, such as Redis, RabbitMQ, Zookeeper and so on, and greatly reduce the probability of error.
As for the application port, in the traditional industry, a server may run a lot of processes, each process has a port, which needs to be configured artificially, and port conflicts need to be considered. If there is a firewall, you also need to configure a firewall. In K8s, the ports are managed and configured uniformly, and the ports of each application can be set to the same, and then load balancing is carried out through service.
Whether for developers, testers or operation and maintenance personnel, the birth of k8s not only reduces the complexity of the work, but also reduces various costs. The changes brought about by the above are only a small part of them, and more advantages can only be realized by using them.
3. Challenges brought by Kubernetes
First of all, the learning of k8s itself is very difficult, there are too many concepts, there is no way to start, may not be able to start learning for a month, or even the cluster can not be built, which is prohibitive. And K8s requires high technical ability of operation and maintenance, which is not limited to traditional operation and maintenance, sometimes you may have to modify the business code and so on. And you need to master a lot of knowledge, you may need to master all the code used by the company, such as how the code is compiled, how to release it correctly, how to modify the code configuration file, etc., which is also a challenge for operators. There are two theories in the industry that Kubernetes is called k8s. Popular saying is that there are 8 letters between k and s. Another comparison is that K8s cluster needs to be built at least 8 times before it can be built successfully. Of course, in actual use, it may be more than 8 times. The birth of K8s changes the operation and maintenance from the traditional to the DevOps direction, and there are more problems and new technologies to face, but when you master the core use of K8s, you will benefit for life.
For developers, there are also some changes in the way they develop. From the birth of K8s to in full swing, K8s has gradually become a standard. Developers need to follow Docker and K8s specifications when developing code, strictly abide by the principle of building once and deploying many times, and all configurations are injected through parameters, variables or K8s configuration management. And for applications, the requirement is stateless, because every restart of Docker starts with the cleanest foundation. Whether the company has carried out business containerization or not, compliance with Docker and K8s specifications will become a future trend. In July 2019, a company lost $3.8 billion a year because its code was not compatible with K8s.
This is the key point
After stepping on numerous pitfalls over the years, I also realized the pain point for every technician to learn k8s. First of all, when the concept of k8s was not clear, he began to deploy applications to the k8s cluster without starting to solve the problems. Secondly, the k8s cluster could not be built anyway, and it was difficult to expand the cluster, and then there was no way to start with continuous integration and continuous deployment. Want to build a whole set of k8s cluster is not limited to the construction of k8s cluster. You also need to process build, release, test, and deployment, as well as connect GitLab, GitRunner, Jenkins, Harbor, Kubernetes, and so on. These are the problems encountered every time you use k8s.
Let's have a wave of unexpected ads.
In fact, the 1234 items listed above are mainly to introduce an upcoming Kubernetes practical technology book, which can help you avoid all kinds of pitfalls encountered in the process of using K8s.
This book can not only help you quickly build a whole set of clusters, but also help you solve all kinds of problems encountered in the process of use. Most of the pits in the process of use have been filled for you, so that you can take a lot of detours and lose a lot of hair. So that you can quickly get into the right path of K8s. This book is suitable for most enterprises, can quickly build the company's K8s platform, and containment all kinds of middleware, business application code, such as Java, NodeJS and so on. The containerization of various components of SpringCloud is also introduced.
This book takes actual combat as the main line and introduces the application of Kubernetes in enterprise production in a profound and simple way. The book consists of six chapters, the main contents include: chapter 1 explains the high-availability installation of Kubernetes, which is divided into kubeadm and binary installation. Chapter 2 introduces the common theoretical basis of Docker and Kubernetes. Chapter 3 focuses on the containerization of common applications of Kubernetes. Chapter 4 mainly introduces continuous integration and continuous deployment, including the use of Jenkins's latest feature Pipeline, from Pipeline syntax to project implementation, containerization of traditional Java and Spring Cloud applications, and automated build and deployment. Chapter 5 mainly explains the installation and common configuration of Nginx Ingress of Kubernetes. Chapter 6 explains the closely watched Server Mesh.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.