您好,登錄后才能下訂單哦!
這期內容當中小編將會給大家帶來有關kubeadm中怎么部署高可用Kubernetes,文章內容豐富且以專業的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
創建集群:
sudo kubeadm init --kubernetes-version=v1.17.0 \ --apiserver-advertise-address=192.168.199.173 \ --control-plane-endpoint=192.168.199.173:6443 \ --pod-network-cidr=10.244.0.0/16 \ --upload-certs
注意:
增加--control-plane-endpoint參數,是用于多Master的部署使用,必須加上。
使用多個Master節點的kubeadm init方法后,輸出有所不同。如下:
To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/ You can now join any number of the control-plane node running the following command on each as root: kubeadm join 192.168.199.173:6443 --token rlxvkn.2ine1loolri50tzt \ --discovery-token-ca-cert-hash sha256:86e68de8febb844ab8f015f6af4526d78a980d9cdcf7863eebb05b17c24b9383 \ --control-plane --certificate-key 440a880086e7e9cbbcebbd7924e6a9562d77ee8de7e0ec63511436f2467f7dde Please note that the certificate-key gives access to cluster sensitive data, keep it secret! As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use "kubeadm init phase upload-certs --upload-certs" to reload certs afterward. Then you can join any number of worker nodes by running the following on each as root: kubeadm join 192.168.199.173:6443 --token rlxvkn.2ine1loolri50tzt \ --discovery-token-ca-cert-hash sha256:86e68de8febb844ab8f015f6af4526d78a980d9cdcf7863eebb05b17c24b9383
運行下面的命令,以使kubectl在當前用戶賬號下可用:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
注意:
上面帶--control-plane參數的命令用于部署一個新的Master節點。
不帶--control-plane參數的命令用于部署worker節點。
增加Master節點:
kubeadm join 192.168.199.173:6443 --token rlxvkn.2ine1loolri50tzt \ --discovery-token-ca-cert-hash sha256:86e68de8febb844ab8f015f6af4526d78a980d9cdcf7863eebb05b17c24b9383 \ --control-plane --certificate-key 440a880086e7e9cbbcebbd7924e6a9562d77ee8de7e0ec63511436f2467f7dde
After Add master node:
sudo kubeadm init phase upload-certs --upload-certs ### Got: # [upload-certs] Using certificate key: # 2ffe5bbf7d2e670d5bcfb03dac194e2f21eb9715f2099c5f8574e4ba7679ff78 # Add certificate-key for Multi Master Node. kubeadm token create --print-join-command --certificate-key 2ffe5bbf7d2e670d5bcfb03dac194e2f21eb9715f2099c5f8574e4ba7679ff78
增加Worker節點:
kubeadm join 192.168.199.173:6443 --token rlxvkn.2ine1loolri50tzt \ --discovery-token-ca-cert-hash sha256:86e68de8febb844ab8f015f6af4526d78a980d9cdcf7863eebb05b17c24b9383
然后部署Network CNI驅動,如下:
docker pull quay.io/coreos/flannel:v0.11.0-amd64 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
查看一下節點狀態:
kubectl get node -o wide
上述就是小編為大家分享的kubeadm中怎么部署高可用Kubernetes了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。