您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这期内容当中小编将会给大家带来有关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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。