• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

使用kubeadm安装kubernetes_v1.20.0

开发技术 开发技术 5天前 9次浏览

环境

操作系统:centos 7.9

Docker: 17.03.1-ce

ip:

192.168.163.101 menqi1-master

192.168.163.102 menqi2-slaver

192.168.163.103 menqi3-slaver

安装containerd/kubelet/kubeadm/kubectl

export REGISTRY_MIRROR=https://registry.cn-hangzhou.aliyuncs.com

curl -sSL https://kuboard.cn/install-script/v1.20.x/install_kubelet.sh | sh -s 1.20.0

初始化 master 节点

export MASTER_IP=192.168.163.101

export APISERVER_NAME=menqi1

export POD_SUBNET=10.100.0.1/16

echo "${MASTER_IP} ${APISERVER_NAME}" >> /etc/hosts

curl -sSL https://kuboard.cn/install-script/v1.20.x/init_master.sh | sh -s 1.20.0 /coredns

检查 master 初始化结果

kubectl get nodes -o wide

初始化 worker节点1

master 节点上执行:

kubeadm token create --print-join-command

得到如下输出:

kubeadm join menqi1:6443 –token v2sdp2.iseaa9a7zxlg2sre     –discovery-token-ca-cert-hash sha256:a76ceb168f32c3281a38552c25e4d0c77a94b75d7237b7f60852fc6606d0c610

针对所有的 worker 节点执行:

export MASTER_IP=192.168.163.102

export APISERVER_NAME=menqi2

echo “${MASTER_IP}    ${APISERVER_NAME}” >> /etc/hosts

kubeadm join menqi1:6443 –token v2sdp2.iseaa9a7zxlg2sre     –discovery-token-ca-cert-hash sha256:a76ceb168f32c3281a38552c25e4d0c77a94b75d7237b7f60852fc6606d0c610

检查初始化结果

master 节点上执行:

kubectl get nodes -o wide

[root@demo-master-a-1 ~]# kubectl get nodes -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
menqi1 Ready control-plane,master 12m v1.20.0 192.168.163.101 <none> CentOS Linux 7 (Core) 3.10.0-1160.6.1.el7.x86_64 docker://17.3.1
menqi2 Ready <none> 11m v1.20.0 192.168.163.102 <none> CentOS Linux 7 (Core) 3.10.0-1160.6.1.el7.x86_64 docker://20.10.7

初始化 worker节点2

初始化方式同节点1

 参考文档

https://kuboard.cn/install/history-k8s/install-k8s-1.20.x.html

 


程序员灯塔
转载请注明原文链接:使用kubeadm安装kubernetes_v1.20.0
喜欢 (0)