Introduction to kubernetes Architecture
Introduction to kubernetes
Kubernetes, K8s for short, is an abbreviation made by using 8 instead of 8 characters "ubernete". Kubernetes is an open source application used to manage containerized applications on multiple hosts in the cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.
Kubelet is the most important controller in Kubernetes, it is the main implementer of Pod and Node API, and Kubelet is responsible for driving the container execution layer. In Kubernetes, application containers are isolated from each other and from the host on which they are running, which is the key point of independent decoupling management of applications.
Controller Manager: responsible for managing various resources in the cluster to ensure that the resources are in the expected state. It consists of many kinds of Controller, including Replication Controller, Endpoints Controller.
Namespace Controller, Serviceaccounts Controller and so on.
Etcd: responsible for saving configuration information of K8s cluster and status information of various resources. When the data changes, etcd will quickly notify the relevant components of K8s. A third-party component that has an alternative solution. Consul 、 zookeeper
Pod: the smallest constituent unit of a K8s cluster. Within a Pod, you can run one or more containers. In most cases, there is only one Container container in a Pod.
Flanner: it is a K8s trunking network scheme, which can guarantee the cross-host communication of Pod. Third-party solutions, there are also alternatives.
Check which node the application is on
[root@master] # kubectl get pod-- all-namespaces
View the details of the node on which the application is applied
[root@master] # kubectl get pod-- all-namespaces-o wide
Kubeler: he is the agent of Node. When Scheduler determines that Pod is running on a Node, it will send the specific configuration information of Pod to the Kubelet,Kubeler of that node, create and run containers based on this information, and report the running status to Master.
Kube-proxy: a container responsible for forwarding TCP/UDP data streams accessing service to the backend. If there are multiple replicas, kube-proxy will achieve load balancing.
Run an example: all three import httpd images and lead to docker images
Create a deployment resource object. Pod controller.
[root@master] # kubectl run test-web-- image=httpd-- replicas=2
View the node:
[root@master] # kubectl get deployments.
Abbreviation:
[root@master ~] # kubectl get deploy
[root@master ~] # kubectl get pod
Which dang drops and restarts kuelet:
[root@master ~] # systemctl restart kubelet
[root@master] # kubectl get pod-o wide
Delete a node:
[root@master ~] # kubectl delete pod test-web-5b56bdff65-j6g75
Or two: that's the reason for the controller.
Analyze the role of each component and the architecture workflow:
1) kubectl sends deployment request to API server
2) API server informs Controller Manager to create a Deployment resource
3) Scheduler performs the scheduling task and distributes two copies of Pod to node01 and node02
4) kubelet on node01 and node02 creates and runs Pod on their respective nodes.
Add:
1. The configuration of the application and the current status information are saved in etcd, and API server reads this data from etcd when kubectl get pod is executed.
2.flannel aftertaste assigns one IP to each Pod. However, no Service resource has been created at this time, and kube-proxy is not currently involved.