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.131port: "22"internal_address: ""role:- controlplane- worker- etcdhostname_override: rke-server-01user: ops
- address: 192.168.2.132port: "22"role:- controlplane- worker- etcdhostname_override: rke-server-02user: ops
- address: 192.168.2.133port: "22"role:- controlplane- worker- etcdhostname_override: rke-server-03user: ops
services:etcd:snapshot: truecreation: 6hretention: 24h
network:plugin: "flannel" mtu: 0options: {}
安裝k8s集群
rke up --config ~/cluster.yml
耐心等待安裝完成就行
驗(yàn)證集群
mkidr -p ~/.kube && cp ./kube_config_cluster.yml ~/.kube/config
kubectl get node
kubectl get pod -A