This article first appeared on my blog
From the first contact with Kubernetes in October last year, to the beginning of the system learning, and then last month to take over the operation and maintenance of Kubernetes cluster, is also to have some understanding of Kubernetes. When learning a technology, we should have our own views on the application scenario and development trend of the technology, so as to know how to adopt a technology reasonably in combination with the situation of the team and the development of the company. So here I want to talk about some of my thoughts on Kubernetes technology in general.
Background and birth purpose of Kubernetes
Kubernetes was born in the background of Docker and Paas. Docker cannot be directly used for slightly complex businesses, because the capabilities provided by Docker are really limited. For complex businesses, cloud generally requires some platform-based capabilities, namely Paas. Kubernetes was born from this background, beating out competitors like Mesos to become the de facto standard for container choreography.
So according to the background of the birth of technology, the purpose of Kubernetes is to make Paas, so to play Kubernetes must have a general view of Paas, below is the left ear mouse comb Paas structure diagram, I think quite comprehensive:
The reasons for building Paas based on Kubernetes are:
- Kubernetes itself provides some core capabilities such as service discovery, StatefulSet, load balancing, service status checking and automatic restart, etc.
- Kubernetes provides plug-in mechanisms (CRD, dynamic access control, etc.) that make it easy to DIY or enhance Kubernetes capabilities;
- The Kubernetes community was very active and produced many high quality projects, such as Prometheus, Rook, etc.;
For these reasons, building Paas on Kubernetes is much easier.
Starting with the difficulty
Kubernetes does have some difficulties, especially the operation of kubernetes cluster, not only need to understand the knowledge of Kubernetes, but also need to understand the use of public cloud. Based on this, many public cloud vendors launched Kubernetes hosting services, not only reduce kubernetes operation and maintenance costs, but also better combined with existing services (such as Ali Cloud Kubernetes hosting services, no longer need to build their own ELK, can use Ali cloud log system).
But the use of hosting services do not feel that the use of hosting services to reduce their learning costs, for Kubernetes operation and maintenance personnel still need to understand the various components of Kubernetes, to understand the use of cloud providers of various products. Only in this way, we know how to plan the network, capacity, storage and so on, and we know how to transform the business to go on Kubernetes.
How to do business on Kubernetes
Here are three points.
- The service needs to set up proper live and ready probes so that Kubernetes knows when to kill the Pod to start a new one and when to turn traffic over to the Pod.
- Set a reasonable resource request and limit. Request sets an average application resource utilization value, and Limit sets a slightly higher value.
- The mixing of online and offline services requires extra attention to prevent offline services from occupying too many Node resources. As a result, online services may be killed. If you can’t do that, don’t mix, and toleraions deploy pods from online and offline businesses to their respective nodes using Nodeselector and Toleraions.
earnings
The revenue of kubernetes in this half year is:
- Resources are highly resilient. When the offline service comes, it applies for spot instances, and when the calculation is finished, it will automatically reclaim spot instances, so the price of computing resources consumed by offline computing is very low.
- Be more agile. There is no need to apply for physical machines from o&M, just deploy POD directly. If the cluster resources are insufficient, it will be automatically expanded, and there is no need to worry about insufficient computing resources.
- The ability to reuse, especially the ability to monitor, to import all metrics into Prometheus, with Prometheus+Grafana, the whole monitoring system is very simple;
- Improve resource utilization, especially business mixing;