Kubernetes集群ezdown脚本一键部署
1.环境准备
主机名 | IP地址 | 集群 | 服务 |
---|
node1 | 10.107.24.81 | node | etcd、api-server、controlor-manager、scheduler |
node2 | 10.107.24.82 | node | kubelet、kube-proxy、docker |
master | 10.107.24.83 | master | kubelet、kube-proxy、docker |
10.107.24.81 node1
10.107.24.82 node2
10.107.24.83 master
ssh-keygen
一路回车
ssh-copy-id -i node1
ssh-copy-id -i node2
ssh-copy-id -i master
ssh master
ssh node1
ssh node2
swapoff -a
sed -i.bak '/swap/s/^/#/' /etc/fstab
systemctl stop firewalld && systemctl disable firewalld
yum install -y git wget
2.脚本安装Kubernetes
[root@master ~]# wget https://github.com/easzlab/kubeasz/releases/download/3.5.2/ezdown
[root@master ~]# chmod +x ezdown
# 国内
[root@master ~]# ./ezdown -D
# 国外
[root@master ~]# ./ezdown -D -m standard
2023-03-19 14:19:49 INFO Action successed: download_all
[root@master ~]# ./ezdown -S
2023-03-19 14:20:13 INFO Action begin: start_kubeasz_docker
2023-03-19 14:20:13 INFO try to run kubeasz in a container
2023-03-19 14:20:13 DEBUG get host IP: 10.107.24.83
fc0377122adc8726397e25b6f0285e04072e6b76b9f6b9bd1a0dca3b17d6e1a2
2023-03-19 14:20:14 INFO Action successed: start_kubeasz_docker
[root@master ~]# docker exec -it kubeasz ezctl new k8s
2023-03-19 06:21:22 DEBUG generate custom cluster files in /etc/kubeasz/clusters/k8s
2023-03-19 06:21:22 DEBUG set versions
2023-03-19 06:21:22 DEBUG cluster k8s: files successfully created.
2023-03-19 06:21:22 INFO next steps 1: to config '/etc/kubeasz/clusters/k8s/hosts'
2023-03-19 06:21:22 INFO next steps 2: to config '/etc/kubeasz/clusters/k8s/config.yml'
[root@master ~]# vim /etc/kubeasz/clusters/k8s/hosts
# 'etcd' cluster should have odd member(s) (1,3,5,...)
[etcd]
10.107.24.83
# master node(s), set unique 'k8s_nodename' for each node
# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.',
# and must start and end with an alphanumeric character
[kube_master]
10.107.24.83 k8s_nodename='master'
# work node(s), set unique 'k8s_nodename' for each node
# CAUTION: 'k8s_nodename' must consist of lower case alphanumeric characters, '-' or '.',
# and must start and end with an alphanumeric character
[kube_node]
10.107.24.81 k8s_nodename='node1'
10.107.24.82 k8s_nodename='node2'
docker exec -it kubeasz ezctl setup k8s all
PLAY RECAP *****************************************************************************************************
10.107.24.81 : ok=76 changed=73 unreachable=0 failed=0 skipped=129 rescued=0 ignored=1
10.107.24.82 : ok=76 changed=73 unreachable=0 failed=0 skipped=129 rescued=0 ignored=1
10.107.24.83 : ok=113 changed=105 unreachable=0 failed=0 skipped=152 rescued=0 ignored=1
localhost : ok=43 changed=40 unreachable=0 failed=0 skipped=42 rescued=0 ignored=0
评论 (0)