How to build a complete Kubernetes cluster
What this article shares with you is a detailed deployment tutorial for building a Kubernetes cluster. I believe most people don't know how to deploy it yet. In order to let you learn, I summarized the following contents. Without saying much, let's move on.
Three official deployment methods: minikube:
Minikube is a tool that allows you to quickly run a single point of Kubernetes locally, only for users who try Kubernetes or daily development
Deployment address: https://kubernetes.io/docs/setup/minikube/
Kubeadm:
Kubeadm is also a tool that provides kubeadm init and kubeadm join for rapid deployment of Kubernetes clusters
Deployment address: https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm/
Binary package:
It is recommended that you download the released binary package from the official version and deploy each package manually to form a Kubernetes cluster.
Download address: https://github.com/kubernetes/kubernetes/releases
To solve the problem of service discovery, we need the following three pillars, one of which is indispensable. A highly consistent, highly available service storage directory
Etcd based on Ralf algorithm is inherently such a highly consistent and highly available service storage directory.
two。 Mechanism for the health status of one-second registration services and health services
Users can register the service in etcdz, configure key TTL for the registered service, and keep the heartbeat of the service regularly to achieve the effect of monitoring health status.
3. A mechanism for finding and connecting services
The service industry registered under the theme specified by etcd can be found under the corresponding topic. In order to ensure connectivity, we can deploy a proxy mode etcd on each service machine, thus ensuring that the services accessing the etcd cluster can be connected to each other.
Binary deployment of multi-node, single etcd cluster
Environmental preparation: related software packages and documentation:
Link: https://pan.baidu.com/s/1nn67GDs8BD6sQTeKH4Ii4w
Extraction code: vx7m
Mester:7-3 192.168.18.128 kube-apiserver kube-controller-manager kube-scheduler etcd
Node1:7-4 192.168.18.148 kubelet kube-proxy docekr flannel etcd
Node2:7-5 192.168.18.145 kubelet kube-proxy docekr flannel etcd
Mester7-3: [root@master ~] # mkdir k8s [root@master ~] # cd k8s/ [root@master k8s] # mkdir etcd-cert [root@master k8s] # mv etcd-cert.sh etcd-cert [root@master k8s] # lsetcd-cert etcd.sh [root@master k8s] # vim cfssl.shcurl-L https://pkg.cfssl.org/R1.2/cfssl_linux-amd64-o / usr/local/bin/cfsslcurl-L https://pkg.cfssl.org/R1.2 / cfssljson_linux-amd64-o / usr/local/bin/cfssljsoncurl-L https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64-o / usr/local/bin/cfssl-certinfochmod + x / usr/local/bin/cfssl / usr/local/bin/cfssljson / usr/local/bin/cfssl-certinfo [root@master K8s] # bash cfssl.sh [root@master K8s] # ls / usr/local/bin/cfssl cfssl-certinfo cfssljson` define CA certificate `cat > ca-config.json