在某些生產環境下,我們僅需要一個原生的 K8s 集羣,無需部署 KubeSphere 這樣的圖形化管理控制檯。在我們已有的技術棧裏,已經習慣了利用 KubeKey 部署 KubeSphere 和 K8s 集羣。今天,我將爲大家實戰演示如何在 openEuler 22.03 LTS SP3 上,利用 KubeKey 部署一套純粹的 K8s 集羣。
實戰服務器配置 (架構 1:1 復刻小規模生產環境,配置略有不同)
主機名 | IP | CPU | 內存 | 系統盤 | 數據盤 | 用途 |
---|---|---|---|---|---|---|
ksp-master-1 | 192.168.9.131 | 8 | 16 | 40 | 100 | k8s-master |
ksp-master-2 | 192.168.9.132 | 8 | 16 | 40 | 100 | k8s-master |
ksp-master-3 | 192.168.9.133 | 8 | 16 | 40 | 100 | k8s-master |
合計 | 3 | 24 | 48 | 120 | 300 |
實戰環境涉及軟件版本信息
-
操作系統:openEuler 22.03 LTS SP3 x64
-
K8s:v1.28.8
-
Containerd:1.7.13
-
KubeKey: v3.1.1
1. 操作系統基礎配置
請注意,以下操作無特殊說明時需在所有服務器上執行。本文只選取 Master-1 節點作爲演示,並假定其餘服務器都已按照相同的方式進行配置和設置。
1.1 配置主機名
hostnamectl hostname ksp-master-1
1.2 配置 DNS
echo "nameserver 114.114.114.114" > /etc/resolv.conf
1.3 配置服務器時區
- 配置服務器時區爲 Asia/Shanghai。
timedatectl set-timezone Asia/Shanghai
1.4 配置時間同步
- 安裝 chrony 作爲時間同步軟件
yum install chrony
- 編輯配置文件
/etc/chrony.conf
,修改 ntp 服務器配置
vi /etc/chrony.conf
# 刪除所有的 pool 配置
pool pool.ntp.org iburst
# 增加國內的 ntp 服務器,或是指定其他常用的時間服務器
pool cn.pool.ntp.org iburst
# 上面的手工操作,也可以使用 sed 自動替換
sed -i 's/^pool pool.*/pool cn.pool.ntp.org iburst/g' /etc/chrony.conf
- 重啓並設置 chrony 服務開機自啓動
systemctl enable chronyd --now
- 驗證 chrony 同步狀態
# 執行查看命令
chronyc sourcestats -v
# 正常的輸出結果如下
[root@ksp-master-1 ~]# chronyc sourcestats -v
.- Number of sample points in measurement set.
/ .- Number of residual runs with same sign.
| / .- Length of measurement set (time).
| | / .- Est. clock freq error (ppm).
| | | / .- Est. error in freq.
| | | | / .- Est. offset.
| | | | | | On the -.
| | | | | | samples. \
| | | | | | |
Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
==============================================================================
111.230.189.174 18 11 977 -0.693 6.795 -1201us 2207us
electrode.felixc.at 18 10 917 +2.884 8.258 -31ms 2532us
tick.ntp.infomaniak.ch 14 7 720 +2.538 23.906 +6176us 4711us
time.cloudflare.com 18 7 913 +0.633 9.026 -2543us 3142us
1.5 關閉系統防火牆
systemctl stop firewalld && systemctl disable firewalld
1.6 禁用 SELinux
openEuler 22.03 SP3 最小化安裝的系統默認啓用了 SELinux,爲了減少麻煩,我們所有的節點都禁用 SELinux。
# 使用 sed 修改配置文件,實現徹底的禁用
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# 使用命令,實現臨時禁用,這一步其實不做也行,KubeKey 會自動配置
setenforce 0
1.7 安裝系統依賴
在所有節點,執行下面的命令爲 Kubernetes 安裝系統基本依賴包。
# 安裝 Kubernetes 系統依賴包
yum install curl socat conntrack ebtables ipset ipvsadm
# 安裝 tar 包,不裝的話後面會報錯。openEuler 也是個奇葩,迭代這麼多版本了,默認居然還不安裝 tar
yum install tar
2. 操作系統磁盤配置
服務器新增一塊數據盤 /dev/sdb,用於 Containerd 和 K8s Pod 的持久化存儲。
爲了滿足部分用戶希望在生產上線後,磁盤容量不足時可以實現動態擴容。本文采用了 LVM 的方式配置磁盤(實際上,本人維護的生產環境,幾乎不用 LVM)。
請注意,以下操作無特殊說明時需在集羣所有節點上執行。本文只選取 Master-1 節點作爲演示,並假定其餘服務器都已按照相同的方式進行配置和設置。
2.1 使用 LVM 配置磁盤
- 創建 PV
pvcreate /dev/sdb
- 創建 VG
vgcreate data /dev/sdb
- 創建 LV
# 使用所有空間,VG 名字爲 data,LV 名字爲 lvdata
lvcreate -l 100%VG data -n lvdata
2.2 格式化磁盤
mkfs.xfs /dev/mapper/data-lvdata
2.3 磁盤掛載
- 手工掛載
mkdir /data
mount /dev/mapper/data-lvdata /data/
- 開機自動掛載
tail -1 /etc/mtab >> /etc/fstab
2.4 創建數據目錄
- 創建 OpenEBS 本地數據根目錄
mkdir -p /data/openebs/local
- 創建 Containerd 數據目錄
mkdir -p /data/containerd
- 創建 Containerd 數據目錄軟連接
ln -s /data/containerd /var/lib/containerd
說明: KubeKey 到 v3.1.1 版爲止,一直不支持在部署的時候更改 Containerd 的數據目錄,只能用這種目錄軟鏈接到變通方式來增加存儲空間(也可以提前手工安裝 Containerd)。
3. 安裝部署 K8s
3.1 下載 KubeKey
本文將 master-1 節點作爲部署節點,把 KubeKey 最新版 (v3.1.1) 二進制文件下載到該服務器。具體 KubeKey 版本號可以在KubeKey release 頁面查看。
- 下載最新版的 KubeKey
mkdir ~/kubekey
cd ~/kubekey/
# 選擇中文區下載(訪問 GitHub 受限時使用)
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | sh -
- 正確的執行結果如下
[root@ksp-master-1 ~]# mkdir ~/kubekey
[root@ksp-master-1 ~]# cd ~/kubekey/
[root@ksp-master-1 kubekey]# export KKZONE=cn
[root@ksp-master-1 kubekey]# curl -sfL https://get-kk.kubesphere.io | sh -
Downloading kubekey v3.1.1 from https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/v3.1.1/kubekey-v3.1.1-linux-amd64.tar.gz ...
Kubekey v3.1.1 Download Complete!
[root@ksp-master-1 kubekey]# ll -h
total 114M
-rwxr-xr-x. 1 root root 79M Apr 16 12:30 kk
-rw-r--r--. 1 root root 36M Apr 25 09:37 kubekey-v3.1.1-linux-amd64.tar.gz
- 查看 KubeKey 支持的 Kubernetes 版本列表
./kk version --show-supported-k8s
[root@ksp-master-1 kubekey]# ./kk version --show-supported-k8s
v1.19.0
......(受限於篇幅,中間的不展示,請讀者根據需求查看)
v1.28.0
v1.28.1
v1.28.2
v1.28.3
v1.28.4
v1.28.5
v1.28.6
v1.28.7
v1.28.8
v1.29.0
v1.29.1
v1.29.2
v1.29.3
說明: 輸出結果爲 KubeKey 支持的結果,但不代表 KubeSphere 和其他 K8s 也能完美支持。本文僅用 KubeKey 部署 K8s,所以不用特別考慮版本的兼容性。
KubeKey 支持的 K8s 版本還是比較新的。本文選擇 v1.28.8,生產環境可以選擇 v1.26.15 或是其他次要版本是雙數,補丁版本數超過 5 的版本。不建議選擇太老的版本了,畢竟 v1.30 都已經發布了。
3.2 創建 K8s 集羣部署配置文件
- 創建集羣配置文件
本文選擇了 K8s v1.28.8。因此,指定配置文件名稱爲 k8s-v1288.yaml,如果不指定,默認的文件名爲 config-sample.yaml。
./kk create config -f k8s-v1288.yaml --with-kubernetes v1.28.8
注意: 生成的默認配置文件內容較多,這裏就不做過多展示了,更多詳細的配置參數請參考 官方配置示例。
- 修改配置文件
本文示例採用 3 個節點同時作爲 control-plane、etcd 和 worker 節點。
編輯配置文件 k8s-v1288.yaml
,主要修改 kind: Cluster 小節的相關配置
修改 kind: Cluster 小節中 hosts 和 roleGroups 等信息,修改說明如下。
- hosts:指定節點的 IP、ssh 用戶、ssh 密碼、ssh 端口
- roleGroups:指定 3 個 etcd、control-plane 節點,複用相同的機器作爲 3 個 worker 節點
- internalLoadbalancer: 啓用內置的 HAProxy 負載均衡器
- domain:自定義域名 lb.opsxlab.cn,沒特殊需求可使用默認值 lb.kubesphere.local
- clusterName:自定義 opsxlab.cn,沒特殊需求可使用默認值 cluster.local
- autoRenewCerts:該參數可以實現證書到期自動續期,默認爲 true
- containerManager:使用 containerd
修改後的完整示例如下:
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: ksp-master-1, address: 192.168.9.131, internalAddress: 192.168.9.131, user: root, password: "OpsXlab@2024"}
- {name: ksp-master-2, address: 192.168.9.132, internalAddress: 192.168.9.132, user: root, password: "OpsXlab@2024"}
- {name: ksp-master-3, address: 192.168.9.133, internalAddress: 192.168.9.133, user: root, password: "OpsXlab@2024"}
roleGroups:
etcd:
- ksp-master-1
- ksp-master-2
- ksp-master-3
control-plane:
- ksp-master-1
- ksp-master-2
- ksp-master-3
worker:
- ksp-master-1
- ksp-master-2
- ksp-master-3
controlPlaneEndpoint:
## Internal loadbalancer for apiservers
internalLoadbalancer: haproxy
domain: lb.opsxlab.cn
address: ""
port: 6443
kubernetes:
version: v1.28.8
clusterName: opsxlab.cn
autoRenewCerts: true
containerManager: containerd
etcd:
type: kubekey
network:
plugin: calico
kubePodsCIDR: 10.233.64.0/18
kubeServiceCIDR: 10.233.0.0/18
## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
multusCNI:
enabled: false
registry:
privateRegistry: ""
namespaceOverride: ""
registryMirrors: []
insecureRegistries: []
addons: []
3.3 部署 K8s
接下來我們執行下面的命令,使用上面生成的配置文件部署 K8s。
export KKZONE=cn
./kk create cluster -f k8s-v1288.yaml
上面的命令執行後,首先 KubeKey 會檢查部署 K8s 的依賴及其他詳細要求。通過檢查後,系統將提示您確認安裝。輸入 yes 並按 ENTER 繼續部署。
[root@ksp-master-1 kubekey]# ./kk create cluster -f k8s-v1288.yaml
_ __ _ _ __
| | / / | | | | / /
| |/ / _ _| |__ ___| |/ / ___ _ _
| \| | | | '_ \ / _ \ \ / _ \ | | |
| |\ \ |_| | |_) | __/ |\ \ __/ |_| |
\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
__/ |
|___/
10:45:28 CST [GreetingsModule] Greetings
10:45:28 CST message: [ksp-master-3]
Greetings, KubeKey!
10:45:28 CST message: [ksp-master-1]
Greetings, KubeKey!
10:45:28 CST message: [ksp-master-2]
Greetings, KubeKey!
10:45:28 CST success: [ksp-master-3]
10:45:28 CST success: [ksp-master-1]
10:45:28 CST success: [ksp-master-2]
10:45:28 CST [NodePreCheckModule] A pre-check on nodes
10:45:31 CST success: [ksp-master-3]
10:45:31 CST success: [ksp-master-1]
10:45:31 CST success: [ksp-master-2]
10:45:31 CST [ConfirmModule] Display confirmation form
+--------------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+
| name | sudo | curl | openssl | ebtables | socat | ipset | ipvsadm | conntrack | chrony | docker | containerd | nfs client | ceph client | glusterfs client | time |
+--------------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+
| ksp-master-1 | y | y | y | y | y | y | y | y | y | | | | | | CST 10:45:31 |
| ksp-master-2 | y | y | y | y | y | y | y | y | y | | | | | | CST 10:45:31 |
| ksp-master-3 | y | y | y | y | y | y | y | y | y | | | | | | CST 10:45:31 |
+--------------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+
This is a simple check of your environment.
Before installation, ensure that your machines meet all requirements specified at
https://github.com/kubesphere/kubekey#requirements-and-recommendations
Continue this installation? [yes/no]:
注意:
- nfs client、ceph client、glusterfs client 3 個與存儲有關的 client 顯示沒有安裝,這個我們後期會在對接存儲的實戰中單獨安裝。
- docker、containerd 會根據配置文件選擇的 containerManager 類型自動安裝。
部署完成需要大約 10-20 分鐘左右,具體看網速和機器配置,本次部署完成耗時 20 分鐘。
部署完成後,您應該會在終端上看到類似於下面的輸出。
10:59:25 CST [ConfigureKubernetesModule] Configure kubernetes
10:59:25 CST success: [ksp-master-1]
10:59:25 CST skipped: [ksp-master-2]
10:59:25 CST skipped: [ksp-master-3]
10:59:25 CST [ChownModule] Chown user $HOME/.kube dir
10:59:26 CST success: [ksp-master-3]
10:59:26 CST success: [ksp-master-2]
10:59:26 CST success: [ksp-master-1]
10:59:26 CST [AutoRenewCertsModule] Generate k8s certs renew script
10:59:27 CST success: [ksp-master-2]
10:59:27 CST success: [ksp-master-3]
10:59:27 CST success: [ksp-master-1]
10:59:27 CST [AutoRenewCertsModule] Generate k8s certs renew service
10:59:28 CST success: [ksp-master-3]
10:59:28 CST success: [ksp-master-2]
10:59:28 CST success: [ksp-master-1]
10:59:28 CST [AutoRenewCertsModule] Generate k8s certs renew timer
10:59:29 CST success: [ksp-master-2]
10:59:29 CST success: [ksp-master-3]
10:59:29 CST success: [ksp-master-1]
10:59:29 CST [AutoRenewCertsModule] Enable k8s certs renew service
10:59:29 CST success: [ksp-master-3]
10:59:29 CST success: [ksp-master-2]
10:59:29 CST success: [ksp-master-1]
10:59:29 CST [SaveKubeConfigModule] Save kube config as a configmap
10:59:29 CST success: [LocalHost]
10:59:29 CST [AddonsModule] Install addons
10:59:29 CST success: [LocalHost]
10:59:29 CST Pipeline[CreateClusterPipeline] execute successfully
Installation is complete.
Please check the result using the command:
kubectl get pod -A
4. 驗證 K8s 集羣
4.1 kubectl 命令行驗證集羣狀態
本小節只是簡單的看了一下基本狀態,並不全面,更多的細節大家自己體驗探索吧。
- 查看集羣節點信息
在 master-1 節點運行 kubectl 命令獲取 K8s 集羣上的可用節點列表。
kubectl get nodes -o wide
在輸出結果中可以看到,當前的 K8s 集羣有三個可用節點、節點的內部 IP、節點角色、節點的 K8s 版本號、容器運行時及版本號、操作系統類型及內核版本等信息。
[root@ksp-master-1 kubekey]# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
ksp-master-1 Ready control-plane,worker 9m43s v1.28.8 192.168.9.131 <none> openEuler 22.03 (LTS-SP3) 5.10.0-182.0.0.95.oe2203sp3.x86_64 containerd://1.7.13
ksp-master-2 Ready control-plane,worker 8m8s v1.28.8 192.168.9.132 <none> openEuler 22.03 (LTS-SP3) 5.10.0-182.0.0.95.oe2203sp3.x86_64 containerd://1.7.13
ksp-master-3 Ready control-plane,worker 8m9s v1.28.8 192.168.9.133 <none> openEuler 22.03 (LTS-SP3) 5.10.0-182.0.0.95.oe2203sp3.x86_64 containerd://1.7.13
- 查看 Pod 列表
輸入以下命令獲取在 K8s 集羣上運行的 Pod 列表。
kubectl get pods -o wide -A
在輸出結果中可以看到, 所有 pod 都在運行。
[root@ksp-master-1 kubekey]# kubectl get pod -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE
kube-system calico-kube-controllers-64f6cb8db5-fsgnq 1/1 Running 0 4m59s 10.233.84.2 ksp-master-1
kube-system calico-node-5hkm4 1/1 Running 0 4m59s 192.168.9.133 ksp-master-3
kube-system calico-node-wqz9s 1/1 Running 0 4m59s 192.168.9.132 ksp-master-2
kube-system calico-node-zzr5n 1/1 Running 0 4m59s 192.168.9.131 ksp-master-1
kube-system coredns-76dd97cd74-66k8z 1/1 Running 0 6m22s 10.233.84.1 ksp-master-1
kube-system coredns-76dd97cd74-94kvl 1/1 Running 0 6m22s 10.233.84.3 ksp-master-1
kube-system kube-apiserver-ksp-master-1 1/1 Running 0 6m39s 192.168.9.131 ksp-master-1
kube-system kube-apiserver-ksp-master-2 1/1 Running 0 4m52s 192.168.9.132 ksp-master-2
kube-system kube-apiserver-ksp-master-3 1/1 Running 0 5m9s 192.168.9.133 ksp-master-3
kube-system kube-controller-manager-ksp-master-1 1/1 Running 0 6m39s 192.168.9.131 ksp-master-1
kube-system kube-controller-manager-ksp-master-2 1/1 Running 0 4m58s 192.168.9.132 ksp-master-2
kube-system kube-controller-manager-ksp-master-3 1/1 Running 0 5m5s 192.168.9.133 ksp-master-3
kube-system kube-proxy-2xpq4 1/1 Running 0 5m3s 192.168.9.131 ksp-master-1
kube-system kube-proxy-9frmd 1/1 Running 0 5m3s 192.168.9.133 ksp-master-3
kube-system kube-proxy-bhg2k 1/1 Running 0 5m3s 192.168.9.132 ksp-master-2
kube-system kube-scheduler-ksp-master-1 1/1 Running 0 6m39s 192.168.9.131 ksp-master-1
kube-system kube-scheduler-ksp-master-2 1/1 Running 0 4m59s 192.168.9.132 ksp-master-2
kube-system kube-scheduler-ksp-master-3 1/1 Running 0 5m5s 192.168.9.133 ksp-master-3
kube-system nodelocaldns-gl6dc 1/1 Running 0 6m22s 192.168.9.131 ksp-master-1
kube-system nodelocaldns-q45jf 1/1 Running 0 5m9s 192.168.9.133 ksp-master-3
kube-system nodelocaldns-rskk5 1/1 Running 0 5m8s 192.168.9.132 ksp-master-2
- 查看 Image 列表
輸入以下命令獲取在 K8s 集羣節點上已經下載的 Image 列表。
[root@ksp-master-1 kubekey]# crictl images ls
IMAGE TAG IMAGE ID SIZE
registry.cn-beijing.aliyuncs.com/kubesphereio/cni v3.27.3 6527a35581401 88.4MB
registry.cn-beijing.aliyuncs.com/kubesphereio/coredns 1.9.3 5185b96f0becf 14.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache 1.22.20 ff71cd4ea5ae5 30.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-apiserver v1.28.8 e70a71eaa5605 34.7MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager v1.28.8 e5ae3e4dc6566 33.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers v3.27.3 3e4fd05c0c1c0 33.4MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy v1.28.8 5ce97277076c6 28.1MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-scheduler v1.28.8 ad3260645145d 18.7MB
registry.cn-beijing.aliyuncs.com/kubesphereio/node v3.27.3 5c6ffd2b2a1d0 116MB
registry.cn-beijing.aliyuncs.com/kubesphereio/pause 3.9 e6f1816883972 321kB
至此,我們已經完成了部署 3 臺 Master 節點 和 Worker 節點複用的最小化 K8s 集羣。
接下來我們將在 K8s 集羣上部署一個簡單的 Nginx Web 服務器,測試驗證 K8s 集羣是否正常。
5. 部署測試資源
本示例使用命令行工具在 K8s 集羣上部署一個 Nginx Web 服務器。
5.1 創建 Nginx Deployment
運行以下命令創建一個部署 Nginx Web 服務器的 Deployment。此示例中,我們將創建具有兩個副本基於 nginx:alpine 鏡像的 Pod。
kubectl create deployment nginx --image=nginx:alpine --replicas=2
5.2 創建 Nginx Service
創建一個新的 K8s 服務,服務名稱 nginx,服務類型 Nodeport,對外的服務端口 80。
kubectl create service nodeport nginx --tcp=80:80
5.3 驗證 Nginx Deployment 和 Pod
- 運行以下命令查看創建的 Deployment 和 Pod 資源。
kubectl get deployment -o wide
kubectl get pods -o wide
- 查看結果如下:
[root@ksp-master-1 kubekey]# kubectl get deployment -o wide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
nginx 2/2 2 2 20s nginx nginx:alpine app=nginx
[root@ksp-master-1 kubekey]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-6c557cc74d-tbw9c 1/1 Running 0 23s 10.233.102.187 ksp-master-2 <none> <none>
nginx-6c557cc74d-xzzss 1/1 Running 0 23s 10.233.103.148 ksp-master-1 <none> <none>
5.4 驗證 Nginx Service
運行以下命令查看可用的服務列表,在列表中我們可以看到 nginx 服務類型 爲 Nodeport,並在 Kubernetes 主機上開放了 30619 端口。
kubectl get svc -o wide
查看結果如下:
[root@ksp-master-1 kubekey]# kubectl get svc -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
kubernetes ClusterIP 10.233.0.1 <none> 443/TCP 4d22h <none>
nginx NodePort 10.233.14.48 <none> 80:30619/TCP 5s app=nginx
5.5 驗證服務
運行以下命令訪問部署的 Nginx 服務,驗證服務是否成功部署。
- 驗證直接訪問 Pod
curl 10.233.102.187
# 訪問結果如下
[root@ks-master-1 ~]# curl 10.233.102.187
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
- 驗證訪問 Service
curl 10.233.14.48
# 訪問結果同上,略
- 驗證訪問 Nodeport
curl 192.168.9.131:30619
# 訪問結果同上,略
6. 自動化 Shell 腳本
文章中所有操作步驟,已全部編排爲自動化腳本,因篇幅限制,不在此文檔中展示。
7. 總結
本文分享了在 openEuler 22.03 LTS SP3 操作系統上,如何利用 KubeSphere 開發的工具 KubeKey,部署 K8s v1.28.8 集羣的詳細流程及注意事項。
主要內容概括如下:
- openEuler 22.03 LTS SP3 操作系統基礎配置
- openEuler 22.03 LTS SP3 操作系統上 LVM 磁盤的創建配置
- 使用 KubeKey 部署 K8s 高可用集羣
- K8s 集羣部署完成後的驗證測試
免責聲明:
- 筆者水平有限,儘管經過多次驗證和檢查,盡力確保內容的準確性,但仍可能存在疏漏之處。敬請業界專家大佬不吝指教。
- 本文所述內容僅通過實戰環境驗證測試,讀者可學習、借鑑,但嚴禁直接用於生產環境。由此引發的任何問題,作者概不負責!
本文由博客一文多發平臺 OpenWrite 發佈!