二、 azure
- management-server 需要有public IP 提供ssh,並安裝 rke
wget https://github.com/rancher/rke/releases/download/v1.4.0/rke_linux-amd64
sudo install -m755 rke_linux-amd64 /usr/local/bin/rke
- 另外三台VM 不需要public IP ,都需要裝docker (且 without root),規格必須是 DS2_v2 以上(不知道為甚麼低於這個規格會一直安裝失敗)
- load-balancer 將三台VM 放進 backend-pool 並打開 http/https 將流量導至三台VM
三、Cluster.yml
撰寫 cluster.yml 並執行
rke up --config ./cluster.yml
nodes:
- address: 10.0.0.4
user: azureuser
role: [controlplane, worker, etcd]
- address: 10.0.0.5
user: azureuser
role: [controlplane, worker, etcd]
- address: 10.0.0.6
user: azureuser
role: [controlplane, worker, etcd]
services:
etcd:
snapshot: true
creation: 6h
retention: 24h
# Required for external TLS termination with
# ingress-nginx v0.22+
ingress:
provider: nginx
options:
use-forwarded-headers: "true"
執行完畢後會出現 kube_config 檔案,將他 install 起來(若無資料夾要先 mkdir)
install -m400 kube_config_cluster.yaml ~/.kube/config
嘗試執行 kubectl (若無請安裝)
kubectl get nodes
NAME STATUS ROLES AGE VERSION
10.0.0.4 NotReady controlplane,etcd,worker 5h45m v1.24.6
10.0.0.5 Ready controlplane,etcd,worker 5h45m v1.24.6
10.0.0.6 Ready controlplane,etcd,worker 5h45m v1.24.6
到這裡,前置作業便告一段落(RKE 已建置完畢),下一篇將開始安裝rancher 。