First, kubernetes architecture
Kubernetes is the Google Open Source container cluster Management system, which provides application deployment, maintenance, extension mechanisms and other functions, using kubernetes can easily manage the cross-machine operation of containerized applications, the main functions are as follows:
1) Use Docker for application wrapping (package), instantiation (instantiate), and run.
2) Run and manage containers across machines in a clustered manner.
3) solve the problem of communication between docker across machine containers.
4) Kubernetes's self-healing mechanism makes container clusters always run in the user's desired state.
The composition of the Kubernetes master node
1, ETCD
All persistence states are saved in ETCD. ETCD supports watch at the same time, so that components can easily change the state of the system to quickly respond and coordinate work.
2. Kubernetes API Server
This component provides support for the API, responds to rest operations, validates the API model, and updates the corresponding objects in the ETCD.
3, Scheduler
By accessing the/binding API in Kubernetes, Scheduler is responsible for pods allocations on each node. Scheduler is plug-in, Kubernetes can support user-defined scheduler in the future.
4. Kubernetes Controller Manager Server
Controller Manager Server is responsible for all other functions, such as the endpoints controller responsible for creating and updating endpoints objects. Node Controller is responsible for the discovery, management and monitoring of nodes. These controllers may be split in the future and provide plug-in implementations.
Kubernetes the composition of slave nodes
1, Kubelet
Kubelet components manage pods and their containers, mirrors, and volumes.
2, Kube-proxy
Kube-proxy is a simple network proxy and load balancer. It implements the service model specifically, and each service is represented on all kube-proxy nodes. Depending on the pods covered by the service's selector, Kube-proxy will load-balance these pods to serve the service's visitors.
Second, kubernetes components
Kubernetes opens the interface in a restful form, with three user-operable rest objects:
1, pod: Kubernetes is the most basic deployment scheduling unit, can contain container, logically represent an instance of an application. For example, a Web site application is built from the front end, back end, and database, and these three components will run in their own containers, so we can create pods with three container.
2. Service: Is the route agent abstraction of Pod, which is used to solve the service discovery problem between pods. Because the operating state of the pod can be changed dynamically (such as switching machines, terminating in the process of shrinking, etc.), the access terminal cannot access the service provided by the Pod by writing dead IP. The introduction of the service is designed to ensure that the dynamic changes to the pod are transparent to the access side, which only needs to know the address of the service to provide the proxy by service.
3. Replicationcontroller: It is the clone abstraction of pod, which is used to solve the expansion and contraction capacity of pod. In general, distributed applications need to replicate multiple resources for performance or high availability, and dynamically scale based on load conditions. With Replicationcontroller, we can specify that an application requires several copies, Kubernetes will create a pod for each copy, and ensure that the actual number of pods is always equal to the number of copies (for example, when a pod is currently down, Automatically creates a new pod to replace).
As you can see, the service and Replicationcontroller are just abstractions built on the pod, and ultimately in the pod, how do they relate to the pod? This introduces the concept of label: The label is a good understanding of the pod plus a set of key/value tags that can be used for search or association, and the service and Replicationcontroller are associated with the pod by label. As shown, there are three pods with the label "App=backend", and when creating service and Replicationcontroller you can specify the same label: "App=backend", and then through the label selector mechanism, They are associated with these three pods. For example, when another frontend pod accesses the service, it is automatically forwarded to one of the backend pods.
Third, package installation
CENTOS7 system can be installed by Yum mode. The latest version of the current kubernetes is 1.9, it is not recommended to use the 1.9 version in the production environment, the official website recommended the use of KUBEADM deployment, in order to more simple and more systematic learning kubernetes cluster components, this series of articles using the RPM method of installation Kubernetes 1.5.2 version, the following will describe how to install the 1.9 version locally offline.
# yum-y Install ETCD kubernetes
1. General configuration file
/etc/kubernetes/config
2. Apiserver Service configuration file
/etc/kubernetes/apiserver
Startup script:/lib/systemd/system/kube-apiserver.service
3. Kube-controller-manager Service configuration file
/etc/kubernetes/controller-manager
Startup script:/lib/systemd/system/kube-controller-manager.service
4. Kube-scheduler Service configuration file
/etc/kubernetes/scheduler
Startup script:/lib/systemd/system/kube-scheduler.service
5. Kubernet Service configuration file
/etc/kubernetes/kubelet
Startup script:/lib/systemd/system/kubelet.service
6. Kube-proxy Service
/etc/kubernetes/proxy
Startup script:/lib/systemd/system/kube-proxy.service
V. Service start-up
1. Master Node
# systemctl start etcd# systemctl start kube-apiserver*# systemctl start kube-controller-manager*# systemctl start kube-scheduler*
2. Slave node
# systemctl start docker*# systemctl start kubelet*# systemctl start kube-proxy*
VI. matters of caution
In a kubernetes system, the requirement for a container is that it needs to be performed at the foreground.
Kubernetes Brief Introduction