2025 年云原生运维实战文档 X 篇原创计划第 14 篇|KubeSphere 最佳实战「2025」系列第 4 篇
各位读者,好久不见,我是术哥,那个带你玩转 KubeSphere 实战的我又回来了!
我是一名专注于云原生、AI技术的布道者。作为 KubeSphere Ambassador 和 Milvus 北辰使者,我很荣幸能在「运维有术」与大家分享经验。
近期,我一直在研究 MCP(Model Context Protocol) 、AI 技术与云原生的结合,特别是探索如何将大语言模型(LLM)与 Kubernetes、KubeSphere 进行深度整合。这种融合不仅可以为企业容器云管理带来智能化的运维能力,还能实现更高效的资源调度和故障预测。在后续的文章中,我将持续分享这些创新实践的经验和心得,帮助更多团队在云原生运维中融入AI的力量。
为了进行这些技术验证,我们需要一个功能完备的测试环境。回顾以往分享的文档,33 张高清大图,带你玩转 KubeSphere v4.1.2 部署与扩展组件安装,我发现当时虽然 Kubernetes 采用了三节点控制平面,但 KubeSphere 的核心服务仍是单点部署,这在生产环境中存在潜在风险。
因此,本文将基于最新的 KubeSphere v4.1.3 和 Kubernetes v1.32.5,手把手教大家搭建一套企业级的高可用集群。这套方案不仅确保了 Kubernetes 控制平面的高可用性,还实现了 KubeSphere 所有核心服务的多副本部署,可以作为生产环境的最佳实践参考。
实战服务器配置(架构1:1复刻小规模生产环境,只是配置略有不同)
节点角色 | 主机名 | CPU(核) | 内存(GB) | 系统盘(GB) | 数据盘(GB) | IP | 备注 |
---|---|---|---|---|---|---|---|
Control 节点 | ksp-control-1 | 4 | 8 | 50 | 100 | 192.168.9.91 | 控制节点 |
Control 节点 | ksp-control-2 | 4 | 8 | 50 | 100 | 192.168.9.92 | 控制节点 |
Control 节点 | ksp-control-3 | 4 | 8 | 50 | 100 | 192.168.9.93 | 控制节点 |
Worker 节点 | ksp-worker-1 | 8 | 32 | 50 | 100 | 192.168.9.94 | 部署通用工作负载 |
Worker 节点 | ksp-worker-2 | 8 | 32 | 50 | 100 | 192.168.9.95 | 部署通用工作负载 |
Worker 节点 | ksp-worker-3 | 8 | 32 | 50 | 100 | 192.168.9.96 | 部署通用工作负载 |
合计 | 6 | 36 | 120 | 300 | 600 |
实战环境涉及软件版本信息
可选配置,可以参考 Kubernetes 集群节点 openEuler 22.03 LTS SP3 系统初始化指南,完成操作系统初始化配置。
如果没有挂载额外的数据盘,无需定制数据存储目录,可以选择使用 KubeKey 自动完成前置条件的安装配置。
虽然,初始化指南以 openEuler 22.03 LTS SP3 为例,但配置过程同样适用于其他 Linux 发行版,只是命令略有不同。
选配:社群成员可以使用 Ansible 脚本完成系统初始化:
# 验证节点连通性
ansible -m ping k8s
# 系统初始化
ansible-playbook ../../playbooks/init-os.yaml -l k8s
# 数据磁盘初始化(使用 LVM)
ansible-playbook ../../playbooks/init-disk-lvm.yaml -l k8s
# kubesphere/k8s 节点初始化(安装 k8s 依赖组件)
ansible-playbook ../../playbooks/deploy-ksp-nodes.yaml
运维有术
本文使用 KubeSphere 官方提供的集群部署工具 KubeKey,搭建一套生产级高可用 Kubernetes 集群。该集群由 3 个 Control 节点组成控制平面,确保集群管理组件的高可用性;同时配备 3 个 Worker 节点用于运行业务工作负载,实现计算资源的合理分配。这种架构设计既保证了集群的稳定性和可靠性,又提供了良好的业务负载承载能力。
在 ksp-control-1 节点上执行以下操作。该节点作为集群的主要控制节点,将用于执行集群部署和管理任务。
mkdir /srv/kubekey
cd /srv/kubekey/
# 选择中文区下载(访问 GitHub 受限时使用)
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | sh -
./kk version --show-supported-k8s
$ ./kk version --show-supported-k8s
v1.19.0
v1.19.8
v1.19.9
v1.19.15
......(受限于篇幅,中间的不展示,请读者根据需求查看)
v1.30.11
v1.30.12
v1.30.13
v1.31.0
v1.31.1
v1.31.2
v1.31.3
v1.31.4
v1.31.5
v1.31.6
v1.31.7
v1.31.8
v1.31.9
v1.32.0
v1.32.1
v1.32.2
v1.32.3
v1.32.4
v1.32.5
v1.33.0
v1.33.1
KubeKey 支持的 Kubernetes 版本非常丰富且及时更新。本文选择最新稳定版 v1.32.5。对于生产环境,建议选择:
选择版本时需要平衡新特性和稳定性,既要确保关键功能可用,又要避免可能的兼容性问题。
本文选择了 v1.32.5 版本的 Kubernetes。为了便于后续管理和维护,我们将配置文件命名为 ksp-k8s-v1325.yaml,这个命名方式清晰地表明了所使用的 Kubernetes 版本。如果不指定配置文件名称,KubeKey 会使用默认的文件名 config-sample.yaml。
./kk create config -f ksp-k8s-v1325.yaml --with-kubernetes v1.32.5
重要提示:
本示例采用 6 节点高可用部署架构,其中:
请使用 vi
编辑器,编辑配置文件 ksp-k8s-v1325.yaml
,修改 kind: Cluster 小节中的以下配置项:
下面是完整的配置示例,请根据实际环境修改相关配置:
apiVersion: kubekey.kubesphere.io/v1alpha2
kind:Cluster
metadata:
name:opsxlabs
spec:
hosts:
-{name:ksp-control-1,address:192.168.9.91,internalAddress:192.168.9.91,user:root,password:"OpsXlab2025!"}
-{name:ksp-control-2,address:192.168.9.92,internalAddress:192.168.9.92,user:root,password:"OpsXlab2025!"}
-{name:ksp-control-3,address:192.168.9.93,internalAddress:192.168.9.93,user:root,password:"OpsXlab2025!"}
-{name:ksp-worker-1,address:192.168.9.94,internalAddress:192.168.9.94,user:root,password:"OpsXlab2025!"}
-{name:ksp-worker-2,address:192.168.9.95,internalAddress:192.168.9.95,user:root,password:"OpsXlab2025!"}
-{name:ksp-worker-3,address:192.168.9.96,internalAddress:192.168.9.96,user:root,password:"OpsXlab2025!"}
roleGroups:
etcd:
-ksp-control-1
-ksp-control-2
-ksp-control-3
control-plane:
-ksp-control-1
-ksp-control-2
-ksp-control-3
worker:
-ksp-worker-1
-ksp-worker-2
-ksp-worker-3
controlPlaneEndpoint:
## Internal loadbalancer for apiservers
internalLoadbalancer:haproxy
domain:lb.opsxlabs.cn
address:""
port:
kubernetes:
version:v1.32.5
clusterName:opsxlabs.cn
#dnsDomain: opsxlabs.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
storage:
openebs:
basePath:/data/openebs/local# 默认没有的新增配置,base path of the local PV
registry:
privateRegistry:"registry.cn-beijing.aliyuncs.com"#使用 KubeSphere 在阿里云的镜像仓库
namespaceOverride:"kubesphereio"
registryMirrors:[]
insecureRegistries:[]
addons:[]
现在我们使用上面生成的配置文件来创建 Kubernetes 集群。执行以下命令开始部署:
export KKZONE=cn
./kk create cluster -f ksp-k8s-v1325.yaml --with-local-storage
重要说明:
--with-local-storage
参数启用本地存储功能执行命令后,KubeKey 会首先进行环境依赖检查,确保满足部署 Kubernetes 的所有要求。检查通过后,系统会要求确认安装,输入 yes 并按 Enter 键继续部署流程。
$ ./kk create cluster -f ksp-k8s-v1325.yaml --with-local-storage
_ __ _ _ __
| | / / | | | | / /
| |/ / _ _| |__ ___| |/ / ___ _ _
| \| | | | '_ \ / _ \ \ / _ \ | | |
| |\ \ |_| | |_) | __/ |\ \ __/ |_| |
\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
__/ |
|___/
09:26:42 CST [GreetingsModule] Greetings
09:26:42 CST message: [ksp-worker-3]
Greetings, KubeKey!
09:26:43 CST message: [ksp-control-3]
Greetings, KubeKey!
09:26:43 CST message: [ksp-control-1]
Greetings, KubeKey!
09:26:43 CST message: [ksp-control-2]
Greetings, KubeKey!
09:26:44 CST message: [ksp-worker-1]
Greetings, KubeKey!
09:26:44 CST message: [ksp-worker-2]
Greetings, KubeKey!
09:26:44 CST success: [ksp-worker-3]
09:26:44 CST success: [ksp-control-3]
09:26:44 CST success: [ksp-control-1]
09:26:44 CST success: [ksp-control-2]
09:26:44 CST success: [ksp-worker-1]
09:26:44 CST success: [ksp-worker-2]
09:26:44 CST [NodePreCheckModule] A pre-check on nodes
09:26:48 CST success: [ksp-control-1]
09:26:48 CST success: [ksp-control-2]
09:26:48 CST success: [ksp-worker-1]
09:26:48 CST success: [ksp-worker-2]
09:26:48 CST success: [ksp-worker-3]
09:26:48 CST success: [ksp-control-3]
09:26:48 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-control-1 | y | y | y | y | y | y | y | y | y | | | | | | CST 09:26:47 |
| ksp-control-2 | y | y | y | y | y | y | y | y | y | | | | | | CST 09:26:48 |
| ksp-control-3 | y | y | y | y | y | y | y | y | y | | | | | | CST 09:26:48 |
| ksp-worker-1 | y | y | y | y | y | y | y | y | y | | | | | | CST 09:26:48 |
| ksp-worker-2 | y | y | y | y | y | y | y | y | y | | | | | | CST 09:26:48 |
| ksp-worker-3 | y | y | y | y | y | y | y | y | y | | | | | | CST 09:26:48 |
+---------------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+
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
Install k8s with specify version: v1.32.5
Continue this installation? [yes/no]: yes
重要说明:
整个部署过程预计需要 5-10 分钟完成。具体耗时取决于:
本次实战环境部署耗时 7 分钟。
当终端显示以下信息时,表示 Kubernetes 集群已成功创建并完成初始化:
:33:26 CST Pipeline[CreateClusterPipeline] execute successfully
Installation is complete.
Please check the result using the command:
kubectl get pod -A
在控制节点1运行 kubectl 命令获取 Kubernetes 集群上的可用节点列表。
kubectl get nodes -o wide
在输出结果中可以看到,当前的 Kubernetes 集群有 6 个可用节点(3 个 Control 节点和 3 个 Worker 节点)。每个节点的详细信息包括:
所有节点状态均为 Ready,表明集群已经成功部署并正常运行。
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
ksp-control-1 Ready control-plane 69s v1.32.5 192.168.9.91 <none> openEuler 24.03 (LTS-SP1) 6.6.0-72.0.0.76.oe2403sp1.x86_64 containerd://1.7.13
ksp-control-2 Ready control-plane 46s v1.32.5 192.168.9.92 <none> openEuler 24.03 (LTS-SP1) 6.6.0-72.0.0.76.oe2403sp1.x86_64 containerd://1.7.13
ksp-control-3 Ready control-plane 45s v1.32.5 192.168.9.93 <none> openEuler 24.03 (LTS-SP1) 6.6.0-72.0.0.76.oe2403sp1.x86_64 containerd://1.7.13
ksp-worker-1 Ready worker 41s v1.32.5 192.168.9.94 <none> openEuler 24.03 (LTS-SP1) 6.6.0-72.0.0.76.oe2403sp1.x86_64 containerd://1.7.13
ksp-worker-2 Ready worker 42s v1.32.5 192.168.9.95 <none> openEuler 24.03 (LTS-SP1) 6.6.0-72.0.0.76.oe2403sp1.x86_64 containerd://1.7.13
ksp-worker-3 Ready worker 42s v1.32.5 192.168.9.96 <none> openEuler 24.03 (LTS-SP1) 6.6.0-72.0.0.76.oe2403sp1.x86_64 containerd://1.7.13
使用以下命令查看集群中所有命名空间的 Pod 运行状态和详细信息。
kubectl get pods -A -o wide
输出结果符合预期, 所有 Pod 的状态都是 Running。
[root@ksp-control-1 kubekey]# kubectl get pods -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system calico-kube-controllers-678fc69664-6hr2k 1/1 Running 0 38s 10.233.96.3 ksp-worker-3 <none> <none>
kube-system calico-node-4nnxh 1/1 Running 0 38s 192.168.9.95 ksp-worker-2 <none> <none>
kube-system calico-node-ch5q7 1/1 Running 0 38s 192.168.9.93 ksp-control-3 <none> <none>
kube-system calico-node-d94p9 1/1 Running 0 38s 192.168.9.92 ksp-control-2 <none> <none>
kube-system calico-node-g8fl5 1/1 Running 0 38s 192.168.9.96 ksp-worker-3 <none> <none>
kube-system calico-node-jnhzw 1/1 Running 0 38s 192.168.9.91 ksp-control-1 <none> <none>
kube-system calico-node-kjs7j 1/1 Running 0 38s 192.168.9.94 ksp-worker-1 <none> <none>
kube-system coredns-5c68fb7f85-46pj8 1/1 Running 0 18s 10.233.101.1 ksp-control-3 <none> <none>
kube-system coredns-5c68fb7f85-thqvq 1/1 Running 0 75s 10.233.96.2 ksp-worker-3 <none> <none>
kube-system haproxy-ksp-worker-1 1/1 Running 0 50s 192.168.9.94 ksp-worker-1 <none> <none>
kube-system haproxy-ksp-worker-2 1/1 Running 0 50s 192.168.9.95 ksp-worker-2 <none> <none>
kube-system haproxy-ksp-worker-3 1/1 Running 0 50s 192.168.9.96 ksp-worker-3 <none> <none>
kube-system kube-apiserver-ksp-control-1 1/1 Running 0 82s 192.168.9.91 ksp-control-1 <none> <none>
kube-system kube-apiserver-ksp-control-2 1/1 Running 0 60s 192.168.9.92 ksp-control-2 <none> <none>
kube-system kube-apiserver-ksp-control-3 1/1 Running 0 59s 192.168.9.93 ksp-control-3 <none> <none>
kube-system kube-controller-manager-ksp-control-1 1/1 Running 0 81s 192.168.9.91 ksp-control-1 <none> <none>
kube-system kube-controller-manager-ksp-control-2 1/1 Running 0 60s 192.168.9.92 ksp-control-2 <none> <none>
kube-system kube-controller-manager-ksp-control-3 1/1 Running 0 59s 192.168.9.93 ksp-control-3 <none> <none>
kube-system kube-proxy-7524z 1/1 Running 0 46s 192.168.9.94 ksp-worker-1 <none> <none>
kube-system kube-proxy-8dscp 1/1 Running 0 47s 192.168.9.95 ksp-worker-2 <none> <none>
kube-system kube-proxy-b6rk5 1/1 Running 0 46s 192.168.9.92 ksp-control-2 <none> <none>
kube-system kube-proxy-bvkd6 1/1 Running 0 45s 192.168.9.96 ksp-worker-3 <none> <none>
kube-system kube-proxy-ns5rs 1/1 Running 0 45s 192.168.9.93 ksp-control-3 <none> <none>
kube-system kube-proxy-rhkhd 1/1 Running 0 46s 192.168.9.91 ksp-control-1 <none> <none>
kube-system kube-scheduler-ksp-control-1 1/1 Running 0 80s 192.168.9.91 ksp-control-1 <none> <none>
kube-system kube-scheduler-ksp-control-2 1/1 Running 0 60s 192.168.9.92 ksp-control-2 <none> <none>
kube-system kube-scheduler-ksp-control-3 1/1 Running 0 59s 192.168.9.93 ksp-control-3 <none> <none>
kube-system nodelocaldns-7blvp 1/1 Running 0 60s 192.168.9.93 ksp-control-3 <none> <none>
kube-system nodelocaldns-7vdm7 1/1 Running 0 72s 192.168.9.91 ksp-control-1 <none> <none>
kube-system nodelocaldns-gtw74 1/1 Running 0 57s 192.168.9.95 ksp-worker-2 <none> <none>
kube-system nodelocaldns-l29sv 1/1 Running 0 61s 192.168.9.92 ksp-control-2 <none> <none>
kube-system nodelocaldns-rl9c8 1/1 Running 0 56s 192.168.9.96 ksp-worker-3 <none> <none>
kube-system nodelocaldns-xctwp 1/1 Running 0 56s 192.168.9.94 ksp-worker-1 <none> <none>
kube-system openebs-localpv-provisioner-9644bcfd5-rvgqz 1/1 Running 0 29s 10.233.94.1 ksp-worker-1 <none> <none>
[root@ksp-control-1 ~]# crictl image ls
IMAGE TAG IMAGE ID SIZE
registry.cn-beijing.aliyuncs.com/kubesphereio/cni v3.27.4 dc6f84c32585f 88.8MB
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.32.5 495c5ce47cf7c 28.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager v1.32.5 85dcaf69f0001 26.4MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers v3.27.4 6b1e38763f401 33.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy v1.32.5 f532b7356fac4 30.9MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-scheduler v1.32.5 2729fb488407e 20.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/node v3.27.4 3dd4390f2a85a 117MB
registry.cn-beijing.aliyuncs.com/kubesphereio/pause 3.10 873ed75102791 320kB
registry.cn-beijing.aliyuncs.com/kubesphereio/pause 3.9 e6f1816883972 322kB
registry.cn-beijing.aliyuncs.com/kubesphereio/pod2daemon-flexvol v3.27.4 72bfa61e35b35 7.64MB
[root@ksp-worker-1 ~]# crictl images ls
IMAGE TAG IMAGE ID SIZE
registry.cn-beijing.aliyuncs.com/kubesphereio/cni v3.27.4 dc6f84c32585f 88.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/coredns 1.9.3 5185b96f0becf 14.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/haproxy 2.9.6-alpine 52687313354fc 12.3MB
registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache 1.22.20 ff71cd4ea5ae5 30.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers v3.27.4 6b1e38763f401 33.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy v1.32.5 f532b7356fac4 30.9MB
registry.cn-beijing.aliyuncs.com/kubesphereio/node v3.27.4 3dd4390f2a85a 117MB
registry.cn-beijing.aliyuncs.com/kubesphereio/pause 3.9 e6f1816883972 322kB
registry.cn-beijing.aliyuncs.com/kubesphereio/pod2daemon-flexvol v3.27.4 72bfa61e35b35 7.64MB
registry.cn-beijing.aliyuncs.com/kubesphereio/provisioner-localpv 3.3.0 739e82fed8b2c 28.8MB
至此,我们已经成功完成了一个生产级高可用 Kubernetes 集群的部署。该集群由 3 台 Control 节点组成的控制平面和 3 台 Worker 节点组成的工作负载平面构成,不仅确保了集群管理组件的高可用性,也为业务应用提供了可靠的运行环境。
运维有术
,赞1
完成 Kubernetes 集群部署后,我们将通过 Helm 安装 KubeSphere v4.1.3,为集群提供强大的可视化管理能力。
使用 Helm 安装 KubeSphere 的核心组件 KubeSphere Core。KubeSphere Core 是 KubeSphere 的基础组件,提供了用户认证、多租户管理、RBAC 等核心功能。
说明:
helm upgrade --install -n kubesphere-system --create-namespace ks-core https://charts.kubesphere.io/main/ks-core-1.1.4.tgz \
--set global.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks \
--set extension.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks \
--set ha.enabled=true \
--set redisHA.enabled=true \
--set multicluster.hostClusterName=opsxlabs-main \
--debug \
--wait
重要配置说明:
ha.enabled
: 设置为 true,启用 KubeSphere 组件高可用部署redisHA.enabled
: 设置为 true,启用 Redis 高可用集群multicluster.hostClusterName
: 自定义主集群名称,默认为 host。版本兼容性提示: ks-core-1.1.4 之前版本使用 hostClusterName
imageRegistry
: 指定组件镜像仓库国内镜像源地址部署过程预计需要 5-10 分钟完成,具体取决于:
当安装命令执行完成后,系统将输出 KubeSphere 控制台访问信息,包括:
看到以下信息表明 KubeSphere Core 已成功完成部署。
NOTES:
ThankyouforchoosingKubeSphereHelmChart.
PleasebepatientandwaitforseveralsecondsfortheKubeSpheredeploymenttocomplete.
.WaitforDeploymentCompletion
Confirm that all KubeSphere components are running by executing the following command:
kubectlgetpods-nkubesphere-system
.AccesstheKubeSphereConsole
Oncethedeploymentiscomplete,you can access the KubeSphere console using the following URL:
http://192.168.9.161:30880
.LogintoKubeSphereConsole
Use the following credentials to log in:
Account:admin
Password:P@88w0rd
NOTE:Itishighlyrecommendedtochangethedefaultpasswordimmediatelyafterthefirstlogin.
Foradditionalinformationanddetails,pleasevisithttps://kubesphere.io.
查看 Pod 列表:
kubectl get pods -n kubesphere-system -o wide
正确执行后,输出结果如下 :
$ kubectl get pods -n kubesphere-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
extensions-museum-67bf6499df-f5xf4 1/1 Running 0 3m18s 10.233.68.15 ksp-worker-2 <none> <none>
ks-apiserver-677647f489-rq6qb 1/1 Running 2 (3m13s ago) 3m18s 10.233.101.19 ksp-control-3 <none> <none>
ks-apiserver-677647f489-w6bw2 1/1 Running 2 (3m13s ago) 3m18s 10.233.71.18 ksp-control-2 <none> <none>
ks-apiserver-677647f489-wpjm4 1/1 Running 2 (3m12s ago) 3m18s 10.233.93.22 ksp-control-1 <none> <none>
ks-console-5855b59f77-6fv9f 1/1 Running 0 2m42s 10.233.68.16 ksp-worker-2 <none> <none>
ks-console-5855b59f77-8x76h 1/1 Running 0 2m38s 10.233.94.7 ksp-worker-1 <none> <none>
ks-console-5855b59f77-9pzhg 1/1 Running 0 2m36s 10.233.71.20 ksp-control-2 <none> <none>
ks-controller-manager-86b4b4cf8-qlk48 1/1 Running 0 3m18s 10.233.101.18 ksp-control-3 <none> <none>
ks-controller-manager-86b4b4cf8-xhwsr 1/1 Running 0 3m18s 10.233.71.16 ksp-control-2 <none> <none>
ks-controller-manager-86b4b4cf8-ztwv4 1/1 Running 0 3m18s 10.233.93.19 ksp-control-1 <none> <none>
ks-core-redisha-haproxy-5d48d7cc88-5p7zw 1/1 Running 0 3m18s 10.233.71.17 ksp-control-2 <none> <none>
ks-core-redisha-haproxy-5d48d7cc88-92td4 1/1 Running 0 3m18s 10.233.93.20 ksp-control-1 <none> <none>
ks-core-redisha-haproxy-5d48d7cc88-drqrf 1/1 Running 0 3m18s 10.233.101.17 ksp-control-3 <none> <none>
ks-core-redisha-server-0 3/3 Running 0 3m18s 10.233.93.23 ksp-control-1 <none> <none>
ks-core-redisha-server-1 3/3 Running 0 2m9s 10.233.71.21 ksp-control-2 <none> <none>
ks-core-redisha-server-2 3/3 Running 0 80s 10.233.101.21 ksp-control-3 <none> <none>
分析 Pod 列表中的核心组件分布情况。
KubeSphere 核心组件高可用部署:
Redis 集群高可用部署:
运维有术
我们打开浏览器访问 Control-1 节点的 IP 地址和端口 30880,可以打开熟悉的 KubeSphere 管理控制台的登录页面。
输入默认用户 admin 和默认密码 P@88w0rd,然后点击「登录」。
登录后,系统会要求您更改 KubeSphere 默认用户 admin 的默认密码,输入新的密码并点击「提交」。
提交完成后,系统会跳转到新的风格的 KubeSphere 用户工作台页面。
ksp-dashboard-v411
在「工作台」页面,点击「集群管理」,进入集群管理页面,页面风格更方便多集群管理。
注意! 集群名称符合我们自定义的 opsxlabs-main,默认名称 host 。
点击「opsxlabs-main 」主集群,进入集群管理页面。新版本的集群管理菜单更加简洁,默认只有基本的 k8s 管理功能。
运维有术
,赞1
以上,就是我今天分享的全部内容。本次实战,我们聚焦于 KubeSphere v4.1.3 高可用集群的部署。从环境准备到 KubeKey 的配置与执行,我们详细梳理了在生产环境中搭建稳定 Kubernetes 集群的关键步骤。通过 3 个 Control 节点和 3 个 Worker 节点的部署实践,我们验证了 KubeKey 在简化复杂集群部署方面的强大能力,并强调了配置细节对集群稳定性的重要影响。
我知道,对于很多朋友来说,搭建一套生产级的高可用集群,听起来可能有些望而却步。但通过这篇实战,你是否发现,只要掌握了正确的方法和工具,这一切并非遥不可及?我们不仅搭建了一个由 3 个 Control 节点和 3 个 Worker 节点组成的强大集群,更深入了解了 KubeKey 如何简化部署流程,以及如何通过精细配置确保集群的稳定与高效。
当然,这仅仅是个开始!KubeSphere 的魅力远不止于此。在接下来的系列文章中,我将继续带你深入探索 KubeSphere 的更多高级特性,比如如何无缝对接各种存储方案,如何玩转多集群管理,以及如何利用 KubeSphere 强大的可观测性功能,让你的云原生环境尽在掌握。
如果你也对云原生、AI 技术充满热情,渴望将理论付诸实践,那么请持续关注「运维有术」!这里不仅有最前沿的技术分享,更有手把手的实战教程,助你成为云原生领域的真正高手。
别忘了,技术之路永无止境,但有我术哥陪你一路同行!下期,我们将揭秘 KubeSphere 在大规模生产环境中的更多秘密武器,敬请期待!
如果你喜欢本文,请分享、收藏、点赞、评论!请持续关注 @运维有术,及时收看更多好文!
欢迎加入 「运维有术学习社群」 ,获取更多的 KubeSphere、Kubernetes、云原生运维、自动化运维、AI 大模型等实战技能。
免责声明:
Get 本文实战视频(请注意,文档视频异步发行,请先关注)
版权声明