stardust-shadow

导航

在K8s集群上安装Kubesphere

Kimi: 在 Kubernetes 上安装 KubeSphere 有多种方式,以下是基于搜索结果中的信息整理的两种常见安装方法:

方法一:使用 KubeKey 安装(推荐)

KubeKey 是 KubeSphere 官方提供的集群安装工具,支持同时安装 Kubernetes 和 KubeSphere。

安装步骤

  1. 安装依赖项

    apt install socat conntrack -y
    

    如果集群节点使用其他操作系统,请将 apt 替换为对应系统的软件包管理工具。

  2. 下载 KubeKey

    curl -sfL https://get-kk.kubesphere.io | sh -
    chmod +x kk
    
  3. 生成集群配置文件

    ./kk create config -f config-sample.yaml --with-kubernetes v1.32.0
    

    编辑生成的 config-sample.yaml 文件,配置集群节点信息、网络插件等参数。

  4. 安装 Kubernetes 和 KubeSphere

    ./kk create cluster -f config-sample.yaml
    

    安装完成后,KubeSphere 的 Web 控制台默认端口为 30880

  5. 验证安装

    kubectl get nodes -o wide
    kubectl get pods --all-namespaces
    

方法二:在已有 Kubernetes 集群上安装 KubeSphere

如果已有 Kubernetes 集群,可以直接通过 Helm 安装 KubeSphere 的核心组件。

安装步骤

  1. 安装 Helm
    确保集群中已安装 Helm,如果未安装,可以参考 Helm 官方文档进行安装。

  2. 添加 KubeSphere Helm 仓库

    helm repo add kubesphere https://charts.kubesphere.io/main
    helm repo update
    
  3. 安装 KubeSphere Core

    helm upgrade --install -n kubesphere-system --create-namespace ks-core kubesphere/ks-core --wait
    

    如果访问 Docker Hub 受限,可以在命令中添加镜像仓库地址,例如:

    --set global.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks
    
  4. 查看安装进度

    kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f
    
  5. 访问 Web 控制台
    安装完成后,通过 NodeIP:30880 访问 KubeSphere 控制台,默认用户名为 admin,密码为 P@88w0rd

注意事项

  • 确保 Kubernetes 集群版本与 KubeSphere 兼容,具体兼容版本可参考 KubeSphere 官方文档。
  • 如果网络环境访问外网受限,可以使用 KubeSphere 提供的离线安装包。

更多详细信息和高级配置选项,可以参考 KubeSphere 官方文档。

posted on 2025-07-23 10:27  阡年  阅读(250)  评论(0)    收藏  举报