8 minutes to understand Kubernetes

Kubernetes Borg born out of Google's system, it is a powerful container filing system. Kubernetes and its entire ecosystem (tools, modules, plug-ins, etc.) are using the Go language, so as to constitute a set for the API, you can program a set of high-speed operation, excellent documentation of these procedures, easy to participate in or contribute to build applications on it.

Each development, operation and maintenance or the interested reader should be familiar with some of its core concepts in order to understand the system and its various functions, and why almost everyone is using it.

Before continuing, I want to mention a few Kubernetes top friends (or competitors): ECS, Nomad and Mesos. ECS is AWS own orchestration solutions, recently launched it's hosted on AWS Kubernetes system --EKS. Both support FARGATE, so that users do not care about the physical resources are running.

Kubernetes is undoubtedly the biggest winner, as an open source system, the three main cloud hosting service providers are in a way to provide this functionality. However, it must be more complicated and confusing than several other products. Kubernetes can handle almost any type of container loads, there are also a lot of skill, but that does not mean that everyone should use it. Other solutions may also be able to meet certain requirements of the company, for example, fully deployed on AWS Internet products company, using ECS ​​will have a better experience than the production environment Kubernetes, yes, better than EKS.

Having said that, Kubernetes magic lies: it can be deployed anywhere, it has an active community, there are hundreds of thousands of core developers and contributors to the open source ecosystem. It runs fast, innovative, modular and oriented API, a plug-in or constructing very service-friendly system.

Well, without further ado, we begin the journey.

11 parts Kubernetes

1. Under

Pod Kubernetes is the smallest unit can be interactive. Pod may be composed of a plurality of containers composed of these containers together to form a unit deployed on a single node. A Pod having an IP, the IP is shared between its container.
In the micro-world service, the Pod can be a single instance of the implementation of micro-services background work or service request.

2. Node (node)

Node machine. They are Kubernetes for deploying Pod "bare metal" (or virtual machine). Node clusters provide available resources to maintain data, run operations, maintenance workload, create a network routing is Kubernetes.

3. Label (label) and Annotation (annotation)

Label is Kubernetes for end users and resources in a manner similar to the filter system, each resource and the resource is "Access" or associated adhesive. For example, to open ports for Deployment Service. Whether monitoring, logging, debugging and testing, any Kubernetes resources should be marked with labels for subsequent inspection. For example, the system to tag all Worker Pod: app = worker, can be used after or --selector field kubectl Kubernetes API in its selection.
Annotation Label and is very similar, but usually used to hold different objects in the form of a free string metadata, such as "Reason for change: Security patch upgrade."

4. Service Discovery (service discovery)

As a scheduling system, Kubernetes controls many different workloads resources, physical resources of the network responsible for managing the Pod, all work and need to communicate. To this end, Kubernetes used ETCD.

ETCD is Kubernetes "internal" database, Master position to get through it all resources. Kubernetes also provides the actual "service discovery" service - all Pod uses a custom DNS server, by parsing the names of other services in order to obtain its IP address and port. It Kubernetes cluster "out of the box" without the need for setting.

5. ReplicaSet (replica set)

While running Pod is a physical task, but generally is not sufficient to use a single instance. For redundancy and load handling, for some reason (such as "telescoping") need to be copied Pod. In order to achieve responsible for the expansion and replication layer, Kubernetes used ReplicaSet. This layer represents the state of the system to a desired number of copies, and at any given moment to maintain the current state of the system.

This is also where the configuration of automatic retractable, create extra copies when the system load is high, and when those resources are no longer needed to support the running workloads volume reduction.

6. DaemonSet (daemon sets)

Sometimes, each instance of the application need no more than one node. For example FileBeat  such Log Collector is a good example. Collects logs from each node to which the agent needs to run on all nodes, but only one instance per node. Kubernetes of DaemonSet can be used to create such a workload.

7. StatefulSet (with a set of states)

Although most micro-services involved are immutable stateless applications, but there are exceptions. Stateful workload depends on reliable support disk volume. Although the application container itself can not be changed, you can use a newer version or instance instead of healthier, but still need all copies of persistent data. StatefulSet that is required for this type of use of the application is deployed in the same node throughout the life cycle.

It also retains its "Name": The name of the hostname found in the cluster and the entire container service. StatefulSet 3 th ZooKeeper configuration may be named zk-1, zk-2 and zk-3, can be extended to more members zk-4, zk-5 and the like is also responsible ...... StatefulSets PersistentVolumeClaim (the connection Pod disk).

8. Job (Tasks)

Kubernetes core team considers most applications use scheduling system. While most applications require running at the same time processing server requests (such as a Web server), but sometimes you need to generate a number of jobs and clean up after its completion. For example, a free mini-server environment.
To achieve this in Kubernetes, you can use the Job resource. As its name implies, Job's job is to generate container to accomplish a specific task, and destroyed upon successful completion. For example, a set of read operation from the Worker to be processed and stored data queue. Once the queue is empty, it is no longer needed Worker, until the next batch is ready.

9. ConfigMap (map configuration) and Secret (secret configuration)

If you are not familiar with twelve elements of the application manifest , please understand in advance. One of the key concepts of modern applications are no environmental, and can be configured by injecting an environment variable. Applications should be completely independent of their location. In order to achieve this important concept in Kubernetes, there is a ConfigMap. In fact, this is a list of key environmental variables, they will be passed to the workload is running to determine the different runtime behavior. In the same category, similar to the normal Secret configuration entries, but will be encrypted to prevent leakage of sensitive information similar keys, passwords, certificates and the like.

I personally think Hashicorp's Vault is the best option to use confidential configuration. Be sure to read what I wrote last year about the article , the article describes the Vault as part of the production for environmental reasons, as well as one of my colleagues wrote another article a more technical article .

10. Deployment (deployment)

Everything looks very nice, Pod can be normal operation, if there is an upper ReplicaSet, it can also be scaled according to the load. However, everyone flocked to the new version is able to quickly replace the application. We want to be on a small scale to build, test and release to shorten the feedback cycle. Use Deployments that is sustainable deployment of new software, which is a set of descriptors specific workloads run the new demands of metadata. For example, revisions, bug fixes, and even roll back (this is another option inside the Kubernetes).
In Kubernetes deploying software can use two main strategies:

  • Replace - as its name, replace the entire load with the new requirements will naturally force the shutdown. For fast replacing non-production environment resources, which is helpful.

  • Rolling upgrades - will be replaced by a new monitor two specific configuration slowly container:

. A MaxAvailable-- set proportion of the work load available when deploying a new version (or specific number), 100% said, "I have two containers, when deployed to keep the two alive in order to service requests";

b. MaxSurge-- set the load ratio on the basis of the current work plan on surviving container (or quantity), 100% means "I have X number of containers, deploy another X containers, then remove the old vessel began to roll."

11. Storage (storage)

Kubernetes add a layer on top of the storage abstraction. Workloads can request a particular store is different tasks, even more than Pod can manage the life cycle of persistence. For brevity, please read author before publication of articles about Kubernetes storage , special emphasis see why it can not completely solve such data similar to a database persistence deployment requirements.

Conceptual understanding

Kubernetes (still) is designed and developed according to some guidelines, each function, concepts and ideas to build in the system are taken into the community factor. In addition, end users will be directed to use the system in some way, but this is not enforced; best practice is also open, but as a free open source system, you can operate according to their own needs.

API-- system for each part can be achieved through interactive documentation and excellent in build operable API. The core developers will ensure that end users can make changes, query and update, so as not to block out unwanted or filter.

Welcome packaging tool - as the previous point of derivative products, Kubernetes welcomed built on top of its tools and API wrapper. As one of the original platform, Kubernetes is a highly customizable way to build for others to use and further development of tools for different use cases. Some tools have become very famous and widely used, such as Spinnaker, Istio and so on.

Declarative state - to encourage users to use the system described in a declarative rather than imperative description. This means that the status of the system and components is best described as the code managed in a version control (such as Git) in order to avoid the problems caused by the manual modification. Therefore, Kubernetes reduce the difficulty of disaster recovery, easier to share and transfer responsibilities among the team.

Original link: https://medium.com/prodopsio/an-8-minute-introduction-to-k8s-94fda1fa5184


Fanger Wei code scanning to add a small assistant, with 8000 native cloud enthusiasts discuss technology trends, advanced combat!

Into the group cipher: Company - Position - City

file

Guess you like

Origin www.cnblogs.com/alisystemsoftware/p/11526534.html
Recommended