大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这期内容当中小编将会给大家带来有关kubeadm中怎么部署高可用Kubernetes,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
10余年的即墨网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销的优势是能够根据用户设备显示端的尺寸不同,自动调整即墨建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“即墨网站设计”,“即墨网站推广”以来,每个客户项目都认真落实执行。
创建集群:
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了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注创新互联行业资讯频道。