Kubernetes (commonly known as K8s) is an open source system for automatically deploying, extending, and managing containerized applications and is an “open source” version of Borg, Google’s internal tool.
Kubernetes is currently recognized as the most advanced container cluster management tool. After the release of version 1.0, Kubernetes has been developing at a faster speed and has been fully supported by container ecosystem companies, including coreos, rancher, and many other public cloud services. Vendors also provide infrastructure services based on Kubernetes’ secondary development when providing container services, such as Huawei. It can be said that Kubernetes is also Docker’s foray into the strongest competitors in container cluster management and service orchestration (Docker Swarm).
Kubernetes defines a set of building blocks that together provide a mechanism for deploying, maintaining, and extending applications. The components that make up Kubernetes are designed to be loosely coupled and scalable so that they can meet a variety of different workloads. Scalability is largely provided by the Kubernetes API – it is used as an internal component of extensions and containers that run on Kubernetes.
Because Kubernetes is a system made up of many components, it is still difficult for Kubernetes to install and deploy, and Kubernetes is developed by Google. There are many internal dependencies that need to be accessed through the wall.
Of course, there are quick installation tools, such as kubeadm, kubeadm is the official tool provided by Kubernetes to quickly install and initialize the Kubernetes cluster. Currently, it is still in an incubator development state. With the release of Kubernetes, the release of each version will be updated synchronously. Of course, the current kubeadm It cannot be used in a production environment.
2. Kubernetes features
Kubernetes features:
- Simple : lightweight, simple, easy to use
- Portable : public, private, hybrid, multi-cloud
- Extensible : modular, plug-in, mountable, combinable
- Self -healing : Automatic layout, automatic restart, automatic copy
In layman terms:
- Automated container deployment and replication
- Expand or shrink containers at any time
- Organize containers into groups and provide load balancing among containers
- Easily upgrade new versions of application containers
- Provide container flexibility to replace a container if it fails
3. Kubernetes terminology
Kubernetes terminology:
- Master Node : The computer used to control the Kubernetes node. All task assignments come from this.
- Minion Node : The computer that performs the request and assignment tasks. The Kubernetes host is responsible for controlling the nodes.
- Namespace : Namespace is an abstract set of a set of resources and objects. For example, it can be used to divide the internal objects of the system into different project groups or user groups. The common pods, services, replication controllers, and deployments are all part of a namespace (the default is default), while node, persistentVolumes, etc. do not belong to any namespace.
- Pod : A container group that is deployed on a single node and contains one or more containers. A Pod can be created, scheduled, and shared with all Kubernetes managed minimum deployment units, all containers in the same container set. IP address, IPC, host name, and other resources. The container set abstracts the network and storage from the underlying container so that you can more easily move the container in the cluster.
- Deployment : Deployment is a new generation of objects for Pod management. Compared with Replication Controller, it provides more complete functionality and is easier and more convenient to use.
- Replication Controller : The replication controller manages the lifecycle of pods. They ensure that a specified number of pods are running at any given time. They do this by creating or deleting pods.
- Service : The service provides a single stable name and address for a group of pods. The service separates the work definition from the container set. The Kubernetes service agent automatically assigns the service request to the correct container set—whether or not the container set moves to the cluster. Which position in it, even if it has been replaced.
- Lable : Labels are used to organize and select object groups based on key-value pairs, which are used for each Kubernetes component.
In Kubernetes, all containers are run in a Pod, a Pod to hold a single container, or multiple cooperating containers. In the latter case, the containers in the Pod are guaranteed to be placed on the same machine and resources can be shared. A Pod can also contain zero or more volumes. Volumes are private to a container or can be shared between containers in a Pod. For each Pod created by the user, the system finds a machine that is healthy and has sufficient capacity, and then starts to start the corresponding container there. If a container fails, it is automatically restarted by Kubernetes’ node agent. This node agent is called a Kubelet. However, if the Pod or his machine fails, it will not be automatically transferred or restarted unless the user also defines a Replication Controller.
Pod’s copy sets can collectively form an entire application, a microservice, or a layer of a multi-tier application. Once the Pod is created, the system continuously monitors their health status and the health of the machine they are running on. If a Pod has problems due to a software problem or a machine failure, the Replication controller automatically creates a new Pod on a healthy machine.
Kubernetes supports a unique network model. Kubernetes encourages the use of flat address spaces and does not dynamically allocate ports, but rather allows users to choose any port that suits them. To achieve this, it assigns each Pod an IP address.
Kubernetes provides an abstraction of Service that provides a stable IP address and DNS name to correspond to a set of dynamic pods, such as a set of pods that make up a microservice. This Pod group is defined by the Label selector, because you can specify any Pod group. When a container running in a Kubernetes Pod connects to this address, the connection is forwarded by the local proxy (called the kube proxy). The agent runs on the source machine, the forwarding destination is a corresponding back-end container, and the exact back-end is selected by the round-robin policy to balance the load. The kube proxy will also track the dynamic changes of the backend Pod group, such as when the Pod is replaced by a new Pod on the new machine, so the IP and DNS names of the service do not need to be changed.
Every Kubernetes resource, such as a pod, is identified by a URI and has a UID. One of the key components in URIs is the type of object (eg, Pod), the name of the object, and the namespace of the object. For a particular object type, each name is unique in its namespace, given the name of an object is not given in the namespace, that is the default namespace, UID in both time and space range only.
More about Service:
- Service is an application service abstraction that provides load balancing and service discovery for the application through labels. The list of Pod IPs and ports that match the labels constitutes endpoints, which are used by kube-proxy to load balance the service IP to these endpoints.
- Each Service automatically assigns a cluster IP (virtual address accessible only within the cluster) and a DNS name from which other containers can access the service without having to know about the backend container’s operation.
Kubernetes components
Kubernetes components:
- kubectl : client command-line tool, formatted commands sent to the kube-apiserver accepted as the operation of the entire system entrance.
- Kube-apiserver : Serves as a control entry for the entire system, providing interfaces with REST API services.
- kube-controller-manager : Used to perform background tasks in the entire system, including the status of nodes, the number of pods, and the association between Pods and Service.
- kube-scheduler ( Pods are scheduled to Node): Responsible for node resource management, accept PUBs created from kube-apiserver and assign them to a node.
- etcd : Responsible for service discovery and configuration sharing between nodes.
- kube-proxy : Runs on each compute node, responsible for the Pod web proxy. Regular Getd service information from etcd to do the appropriate strategy.
- kubelet : runs on each compute node, acts as an agent, accepts Pods tasks and management containers that are assigned to this node, periodically obtains container status and feeds back to kube-apiserver.
- DNS : An optional DNS service for creating DNS records for each Service object so that all pods can access services through DNS.
- flannel : Flannel is CoreOS team designed a cover for Kubernetes network (Overlay Network) tool, you need to download another deployment. We know that when we start Docker there will be an IP address for interacting with the container. If you do not manage it, the IP address may be the same on all machines, and it is limited to communicate on the machine, you can not access Docker containers on other machines. The purpose of the Flannel is to re-plan the use of IP addresses for all nodes in the cluster, so that containers on different nodes can obtain IP addresses that belong to the same intranet and do not duplicate IP addresses, and allow containers belonging to different nodes to directly pass the IP address. Network IP communication.
master node contains the components:
docker
etcd
kube-apiserver
kube-controller-manager
kubelet
kube-scheduler
The minion node contains components:
Docker
kubelet
kube-proxy
Recent Comments