Kubernetes安装KubeSphere(v3.4.1)

注意事项

  • 确保 Kubernetes 版本和 KubeSphere 版本可兼容(KubeSphere官网建议,本人安装没按这个要求来搭建也是成功的):如需在 Kubernetes 上安装 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.x。
  • Kubernetes 集群已配置默认 StorageClass

环境说明

  • 操作系统&内核版本:CentOS Linux 7 (Core) & 3.10.0-1127.el7.x86_64
  • Docker版本:19.3.11(Master) 24.0.6(Node)
  • Kubernetes版本:v1.27.4

安装步骤

  • 步骤一:
    通过线上yaml文件部署KubeSphere:
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/kubesphere-installer.yaml
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/cluster-configuration.yaml
  • 步骤二:
    安装信息查看:
#k8s检查控制台service的端口(默认为30880)
kubectl get svc/ks-console -n kubesphere-system -o wide
#日志打印如下所示:
NAME         TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE   SELECTOR
ks-console   NodePort   10.102.30.142   <none>        80:30880/TCP   39d   app=ks-console,tier=frontend

#通过NodePort(IP:30880)使用默认帐户和密码(admin/P@88w0rd)访问 Web 控制台


#额外补充
#k8s查看kubesphere-system命名空间下的pod,查看ks-console安装的节点机器
kubectl get pod -n kubesphere-system -o wide
#日志打印如下所示(安装在k8s-node1节点):
NAME                                     READY   STATUS      RESTARTS       AGE   IP            NODE        NOMINATED NODE   READINESS GATES
ks-apiserver-7f96c68555-k68lm            1/1     Running     4              25d   10.244.1.5    k8s-node1   <none>           <none>
ks-console-5849989f6-22dsd               1/1     Running     2              25d   10.244.1.8    k8s-node1   <none>           <none>
#登录到k8s-node1节点,查看具体的容器
docker ps |grep ks-console
#找到具体的ks-console容器后,查看日志
docker logs -f <容器ID>
#容器日志会打印以下信息:

**************************************************
Collecting installation results ...
#####################################################
### Welcome to KubeSphere! ###
#####################################################

Console: http://192.168.0.26:30880
Account: admin
Password: P@88w0rd
NOTES:
1. After you log into the console, please check the
monitoring status of service components in
"Cluster Management". If any service is not
ready, please wait patiently until all components
are up and running.
2. Please change the default password after login.

#####################################################
https://kubesphere.io 2023-10-27 15:44:13
#####################################################

问题

问题一:k8查看所有KubeSphere相关的资源类型服务都启动成功,但浏览器无法访问

原因分析

防火墙搭建k8s时未关闭,未开放 30880 端口
云服务器安全组中未打开 30880 端口

解决方案

  • 防火墙开放30880端口:
firewall-cmd --zone=public --add-port=30880/tcp --permanent
firewall-cmd --reload
  • 云服务器安全组中未打开 30880 端口

问题二:KubeSphere应用模板安装点击[安装]按钮无法使用 TypeError: Cannot read properties of undefined (reading 'slice')

原因分析

KubeSphere v3.4.0版本存在这个问题

解决方案

强制更新到v3.4.1:kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/kubesphere-installer.yaml --force

posted @ 2023-12-06 14:00  小舟杂笔  阅读(972)  评论(0)    收藏  举报