差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:rke-k8s [2021/04/07 19:03] – jonathan | tech:rke-k8s [2022/07/19 16:55] (目前版本) – [關閉 rke (移除 K8s Cluster)] jonathan | ||
---|---|---|---|
行 53: | 行 53: | ||
===== 安裝 rke 與建立 K8s Cluster ===== | ===== 安裝 rke 與建立 K8s Cluster ===== | ||
+ | * 參考 - https:// | ||
* 下載 rke 1.2.7 <cli> | * 下載 rke 1.2.7 <cli> | ||
wget https:// | wget https:// | ||
行 61: | 行 62: | ||
* 產生 rke 配置 K8s Cluster 檔< | * 產生 rke 配置 K8s Cluster 檔< | ||
rke config --name cluster.yml | rke config --name cluster.yml | ||
- | </ | + | </ |
+ | * ++看輸入資訊|< | ||
localadmin@Cori-test3: | localadmin@Cori-test3: | ||
[+] Cluster Level SSH Private Key Path [~/ | [+] Cluster Level SSH Private Key Path [~/ | ||
行 94: | 行 96: | ||
[+] Authentication Strategy [x509]: | [+] Authentication Strategy [x509]: | ||
[+] Authorization Mode (rbac, none) [rbac]: | [+] Authorization Mode (rbac, none) [rbac]: | ||
- | [+] Kubernetes Docker image [rancher/ | + | [+] Kubernetes Docker image [rancher/ |
[+] Cluster domain [cluster.local]: | [+] Cluster domain [cluster.local]: | ||
[+] Service Cluster IP Range [10.43.0.0/ | [+] Service Cluster IP Range [10.43.0.0/ | ||
行 104: | 行 106: | ||
* 檢視與編輯 cluster.yml 內容< | * 檢視與編輯 cluster.yml 內容< | ||
nodes: | nodes: | ||
- | - address: | + | - address: 10.20.0.35 |
port: " | port: " | ||
- | internal_address: | + | internal_address: |
role: | role: | ||
- controlplane | - controlplane | ||
- worker | - worker | ||
- etcd | - etcd | ||
- | hostname_override: | + | hostname_override: |
+ | user: rkeuser | ||
+ | docker_socket: | ||
+ | ssh_key: "" | ||
+ | ssh_key_path: | ||
+ | ssh_cert: "" | ||
+ | ssh_cert_path: | ||
+ | labels: {} | ||
+ | taints: [] | ||
+ | - address: 10.20.0.37 | ||
+ | port: " | ||
+ | internal_address: | ||
+ | role: | ||
+ | - worker | ||
+ | hostname_override: | ||
user: rkeuser | user: rkeuser | ||
docker_socket: | docker_socket: | ||
行 122: | 行 138: | ||
services: | services: | ||
etcd: | etcd: | ||
+ | image: "" | ||
: | : | ||
: | : | ||
</ | </ | ||
+ | * 開始執行安裝 <cli> | ||
+ | rke up --config cluster.yml | ||
+ | </ | ||
+ | : | ||
+ | INFO[0378] [addons] Executing deploy job rke-ingress-controller | ||
+ | INFO[0405] [ingress] ingress controller nginx deployed successfully | ||
+ | INFO[0405] [addons] Setting up user addons | ||
+ | INFO[0405] [addons] no user addons defined | ||
+ | INFO[0405] Finished building Kubernetes cluster successfully | ||
+ | </ | ||
+ | * 將產生的檔案備份起來 <cli> | ||
+ | $ ls -lt | ||
+ | total 4476 | ||
+ | -rw-r----- | ||
+ | -rw-r----- | ||
+ | -rw-r----- | ||
+ | </ | ||
+ | * 複製 kubeconfig 檔案及驗證 kubeconfig 檔案< | ||
+ | cp kube_config_cluster.yml ~/ | ||
+ | kubectl get nodes | ||
+ | </ | ||
+ | $ kubectl get node | ||
+ | NAME | ||
+ | 10.20.0.35 | ||
+ | 10.20.0.37 | ||
+ | </ | ||
+ | ===== 新增與移除 K8s Node ==== | ||
+ | * 只要修改 cluster.yml 節點資料, | ||
+ | * Exp. 加上 10.20.0.36 | ||
+ | * 前面所有節點準備程序都要進行 | ||
+ | * 修改 cluster.yml < | ||
+ | nodes: | ||
+ | - address: 10.20.0.35 | ||
+ | port: " | ||
+ | internal_address: | ||
+ | role: | ||
+ | - controlplane | ||
+ | - worker | ||
+ | - etcd | ||
+ | hostname_override: | ||
+ | user: rkeuser | ||
+ | docker_socket: | ||
+ | ssh_key: "" | ||
+ | ssh_key_path: | ||
+ | ssh_cert: "" | ||
+ | ssh_cert_path: | ||
+ | labels: {} | ||
+ | taints: [] | ||
+ | - address: 10.20.0.36 | ||
+ | port: " | ||
+ | internal_address: | ||
+ | role: | ||
+ | - worker | ||
+ | hostname_override: | ||
+ | user: rkeuser | ||
+ | docker_socket: | ||
+ | ssh_key: "" | ||
+ | ssh_key_path: | ||
+ | ssh_cert: "" | ||
+ | ssh_cert_path: | ||
+ | labels: {} | ||
+ | taints: [] | ||
+ | - address: 10.20.0.37 | ||
+ | port: " | ||
+ | internal_address: | ||
+ | role: | ||
+ | - worker | ||
+ | hostname_override: | ||
+ | user: rkeuser | ||
+ | docker_socket: | ||
+ | ssh_key: "" | ||
+ | ssh_key_path: | ||
+ | ssh_cert: "" | ||
+ | ssh_cert_path: | ||
+ | labels: {} | ||
+ | taints: [] | ||
+ | services: | ||
+ | etcd: | ||
+ | : | ||
+ | : | ||
+ | </ | ||
+ | * 執行更新 <cli> | ||
+ | rke up --update-only --config cluster.yml | ||
+ | </ | ||
+ | |||
+ | ===== 關閉 rke (移除 K8s Cluster) ==== | ||
+ | * 直接執行 rke remove 就會將 K8s 移除 <cli> | ||
+ | rke remove --config cluster.yml | ||
+ | </ | ||
+ | * 執行後原本運行中的 rancher 服務還會持續運行, | ||
===== 參考網址 ===== | ===== 參考網址 ===== | ||
* https:// | * https:// | ||
+ | * https:// | ||
- | {{tag> | + | {{tag>Rancher |