rke 安装k8s
规划 (1台master,3台node)
rke(master) 192.168.1.8
node1 192.168.1.5
node2 192.168.1.6
node3 192.168.1.7
#####################
master上运行
cat >> /etc/hosts/ <<EOF
192.168.1.8 master
192.168.1.5 node1
192.168.1.6 node2
192.168.1.7 node3
EOF
###########
hostnamectl set-hostname master
###################离线文件
rpm -ivh docker-ce*.rpm containerd.io-*.rpm --nodeps --force
#################################
systemctl restart docker
########################
ssh-keygen
ssh-copy-id root@192.168.1.5
################################
wget https://github.com/rancher/rke/releases/download/v1.1.4/rke_linux-amd64
###############或者离线包上传
mv rke_linux-amd6411 /usr/local/bin/rke
chmod +x /usr/local/bin/rke
####################
cat >> cluster.yml <<EOF
nodes:
- address: 192.168.1.5
user: rancher
role: [controlplane,worker,etcd]
ssh_key_path: ~/.ssh/id_rsa - address: 192.168.1.6
user: rancher
role: [controlplane,worker,etcd]
ssh_key_path: ~/.ssh/id_rsa - address: 192.168.1.7
user: rancher
role: [controlplane,worker,etcd]
ssh_key_path: ~/.ssh/id_rsa
kubernetes_version: v1.18.6-rancher1-1
EOF
###############################
rke up --config ./cluster.yml
##########################
wget https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
###################或者上传离线包
mv kubectl /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl
kubectl get nodes