**《KubeSphere平臺安裝系列》** |
【Kubernetes上安裝KubeSphere(親測–實操完整版)】(1/3)
【Linux單節點部署KubeSphere】(2/3)
【Linux多節點部署KubeSphere】(3/3)
**《KubeSphere平臺安裝系列》** |
文章目錄
- 1、準備二臺服務器
- 2、使用KubeKey創建集群
- 2.1、下載KubeKey
- 2.2、創建集群配置文件
- 2.3. 編輯配置文件
- 2.4、使用配置文件創建集群
- 2.5、查看進度
- 2.6、驗證安裝
網絡要好,必須穩定!
網絡要好,必須穩定!
網絡要好,必須穩定!
1、準備二臺服務器
- 4c8g (master)
- 4c8g (worker)
- centos7.9
- 內網互通
- 每個機器有自己域名
- 防火墻開放30000~32767端口
設置主機名:
#主節點
hostnamectl set-hostname k8s-multi-master01-101#工作節點
hostnamectl set-hostname k8s-multi-node01-111
主機名 | IP |
---|---|
k8s-multi-master01-101 | 192.168.162.101 |
k8s-multi-node01-111 | 192.168.162.111 |
兩臺機子都執行關閉防火墻:
systemctl stop firewalld
systemctl disable firewalld
2、使用KubeKey創建集群
2.1、下載KubeKey
只在master節點執行以下命令:
# 導出環境變量
export KKZONE=cn
## 下載kk文件
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
## 放開kk的操作權限
chmod +x kk
2.2、創建集群配置文件
在master節點操作:
#創建config配置文件
./kk create config --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
注意:安裝 KubeSphere 3.4 的建議 Kubernetes 版本:v1.20.x、v1.21.x、* v1.22.x、* v1.23.x、* v1.24.x、* v1.25.x 和 * v1.26.x。帶星號的版本可能出現邊緣節點部分功能不可用的情況。因此,如需使用邊緣節點,推薦安裝 v1.23。如果不指定 Kubernetes 版本,KubeKey 將默認安裝 Kubernetes v1.23.10。
2.3. 編輯配置文件
如果您不更改名稱,那么將創建默認文件 config-sample.yaml。編輯文件,以下是多節點集群(具有一個主節點)配置文件的示例。
2.4、使用配置文件創建集群
./kk create cluster -f config-sample.yaml
yum install -y conntrack
整個安裝過程可能需要 10 到 20 分鐘,具體取決于您的計算機和網絡環境。
這里如果提示需要安裝一些前置環境,每個節點都yum -y 命令安裝一下。
2.5、查看進度
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
2.6、驗證安裝
安裝完成后,您會看到如下內容:
#####################################################
### Welcome to KubeSphere! ###
#####################################################Console: http://192.168.162.101:30880
Account: admin
Password: P@88w0rdNOTES:1. After you log into the console, please check themonitoring status of service components in"Cluster Management". If any service is notready, please wait patiently until all components are up and running.2. Please change the default password after login.#####################################################
https://kubesphere.io 2024-03-02 20:24:05
#####################################################
INFO[20:24:15 CST] Installation is complete.Please check the result using the command:kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
現在,您可以通過 <NodeIP:30880 使用默認帳戶和密碼 (admin/P@88w0rd) 訪問 KubeSphere 的 Web 控制臺。
注意:若要訪問控制臺,您可能需要根據您的環境配置端口轉發規則。還請確保在您的安全組中打開了端口 30880。
當你覺得自己很難的時候,說明你在走上坡路,別急,美好正在馬不停蹄地趕來的路上。