rke config
[+] Cluster Level SSH Private Key Path [~/.ssh/id_rsa]:
[+] Number of Hosts [1]: 3
[+] SSH Address of host (1) [none]: 192.168.2.131
[+] SSH Port of host (1) [22]:
[+] SSH Private Key Path of host (192.168.2.131) [none]:
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host (192.168.2.131) [none]:
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_rsa
[+] SSH User of host (192.168.2.131) [ubuntu]: ops
[+] Is host (192.168.2.131) a Control Plane host (y/n)? [y]: y
[+] Is host (192.168.2.131) a Worker host (y/n)? [n]: y
[+] Is host (192.168.2.131) an etcd host (y/n)? [n]: y
[+] Override Hostname of host (192.168.2.131) [none]: rke-server-01
[+] Internal IP of host (192.168.2.131) [none]:
[+] Docker socket path on host (192.168.2.131) [/var/run/docker.sock]:
[+] SSH Address of host (2) [none]: 192.168.2.132
[+] SSH Port of host (2) [22]:
[+] SSH Private Key Path of host (192.168.2.132) [none]:
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host (192.168.2.132) [none]:
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_rsa
[+] SSH User of host (192.168.2.132) [ubuntu]: ops
[+] Is host (192.168.2.132) a Control Plane host (y/n)? [y]: y
[+] Is host (192.168.2.132) a Worker host (y/n)? [n]: y
[+] Is host (192.168.2.132) an etcd host (y/n)? [n]: y
[+] Override Hostname of host (192.168.2.132) [none]: rke-server-02
[+] Internal IP of host (192.168.2.132) [none]:
[+] Docker socket path on host (192.168.2.132) [/var/run/docker.sock]:
[+] SSH Address of host (3) [none]: 192.168.2.133
[+] SSH Port of host (3) [22]:
[+] SSH Private Key Path of host (192.168.2.133) [none]:
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host (192.168.2.133) [none]:
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_rsa
[+] SSH User of host (192.168.2.133) [ubuntu]: ops
[+] Is host (192.168.2.133) a Control Plane host (y/n)? [y]: y
[+] Is host (192.168.2.133) a Worker host (y/n)? [n]: y
[+] Is host (192.168.2.133) an etcd host (y/n)? [n]: y
[+] Override Hostname of host (192.168.2.133) [none]: rke-server-03
[+] Internal IP of host (192.168.2.133) [none]:
[+] Docker socket path on host (192.168.2.133) [/var/run/docker.sock]:
[+] Network Plugin Type (flannel, calico, weave, canal, aci) [canal]: flannel
[+] Authentication Strategy [x509]:
[+] Authorization Mode (rbac, none) [rbac]: rabc
[+] Kubernetes Docker image [rancher/hyperkube:v1.20.9-rancher1]:
[+] Cluster domain [cluster.local]:
[+] Service Cluster IP Range [10.43.0.0/16]:
[+] Enable PodSecurityPolicy [n]:
[+] Cluster Network CIDR [10.42.0.0/16]:
[+] Cluster DNS Service IP [10.43.0.10]:
[+] Add addon manifest URLs or YAML files [no]:
使用已定义好的cluster.yml
# If you intened to deploy Kubernetes in an air-gapped environment,
# please consult the documentation on how to configure custom RKE images.
nodes:
- address: 192.168.2.131
port: "22"
internal_address: ""
role:
- controlplane
- worker
- etcd
hostname_override: rke-server-01
user: ops
- address: 192.168.2.132
port: "22"
role:
- controlplane
- worker
- etcd
hostname_override: rke-server-02
user: ops
- address: 192.168.2.133
port: "22"
role:
- controlplane
- worker
- etcd
hostname_override: rke-server-03
user: ops
services:
etcd:
snapshot: true
creation: 6h
retention: 24h
network:
plugin: "flannel"
mtu: 0
options: {}
安装k8s集群
rke up --config ~/cluster.yml
耐心等待安装完成就行
验证集群
mkidr -p ~/.kube && cp ./kube_config_cluster.yml ~/.kube/config
kubectl get node
kubectl get pod -A
文章目录使用rke安装高可用k8s集群rke 增加和移除节点彻底清理rke节点使用rke安装高可用k8s集群服务器rke集群节点角色规划用户主机名内网IPSSH端口系统rke 角色opsrke-server-01192.168.2.13122CentOS Linux release 7.6.1810 (Core)controlplane、worker、etcdopsrke-server-02192.168.2.13222CentOS Linux