1、相關資源導航
https://blog.csdn.net/zyj81092211/article/details/123068347
2、架構
3、環境介紹
作業系統:centos 7.9
cpu:4核心
記憶體:8GB
磁盤:100GB
IP位址規劃:
K3S-Server-01 10.99.24.11 k3sserver01.wtown.com
K3S-Server-02 10.99.24.12 k3sserver02.wtown.com
K3S-Agent-01 10.99.24.16 k3sagent01.wtown.com
K3S-Agent-02 10.99.24.17 k3sagent02.wtown.com
4、關閉防火牆和selinux
5、更改主機名和host檔案
6、建立外部資料庫
https://blog.csdn.net/zyj81092211/article/details/123088374
7、在K3S-Server-01上啟動server節點
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - server --token=SECRET --datastore-endpoint="mysql://root:[email protected](127.0.0.1:3306)/k3s" --node-taint CriticalAddonsOnly=true:NoExecute
8、擷取token
cat /var/lib/rancher/k3s/server/token
9、K3S-Server-02加入叢集
使用上一步擷取的token
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - server --token=K103fef6f2b47f87b374da142a188b90044fb45d59da5733ac6f4a11acf4504cff0::server:SECRET --datastore-endpoint="mysql://root:[email protected](127.0.0.1:3306)/k3s" --node-taint CriticalAddonsOnly=true:NoExecute
10、agent節點加入叢集
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=K103fef6f2b47f87b374da142a188b90044fb45d59da5733ac6f4a11acf4504cff0::server:SECRET K3S_URL=https://10.99.24.11:6443 sh -
11、檢查叢集狀态
k3s kubectl get nodes -o wide
12、報錯處理
helm執行時報錯
執行: vi /etc/profile
寫入内容: export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
執行: source /etc/profile