在 Kubernetes 上快速安装 KubeSphere

本节介绍如何在单个节点上快速部署 Kubernetes 和 KubeSphere。此安装方法仅适用于测试,若要在生产环境中安装 KubeSphere,请参阅安装 Kubernetes 和 KubeSphere

前提条件

  • 准备一台 Linux 主机,并确保其满足最低硬件要求:CPU > 2 核,内存 > 4 GB, 磁盘空间 > 40 GB。

  • 您需要提前安装 Helm

操作步骤

  1. (可选)如果您没有可用的 Kubernetes 集群,执行以下命令快速创建一个 Kubernetes 集群。

    1. 如果您访问 GitHub/Googleapis 受限,请登录 Linux 主机,执行以下命令设置下载区域。

      1. export KKZONE=cn
    2. 执行以下命令安装⼯具 KubeKey。

      下载完成后当前目录下将生成 KubeKey 二进制文件 kk

      1. curl -sfL https://get-kk.kubesphere.io | sh -
    3. 执行以下命令安装依赖项。

      1. apt install socat conntrack -y
    4. 执行以下命令快速创建一个 Kubernetes 集群。

      1. ./kk create cluster --with-local-storage --with-kubernetes v1.31.0 --container-manager containerd -y
  2. 如果您已经拥有可用的 Kubernetes 集群,执行以下命令通过 helm 安装 KubeSphere 的核心组件 KubeSphere Core。

    1. helm upgrade --install -n kubesphere-system --create-namespace ks-core https://charts.kubesphere.io/main/ks-core-1.1.2.tgz --debug --wait
    说明

    如果您访问 Docker Hub 受限,请在命令后添加如下配置,修改默认的镜像拉取地址。

    1. set global.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks
    1. set extension.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks
  3. 安装完成后,输出信息会显示 KubeSphere Web 控制台的 IP 地址和端口号,默认的 NodePort 是 30880。

    1. NOTES:
    2. Thank you for choosing KubeSphere Helm Chart.
    3. Please be patient and wait for several seconds for the KubeSphere deployment to complete.
    4. 1. Wait for Deployment Completion
    5. Confirm that all KubeSphere components are running by executing the following command:
    6. kubectl get pods -n kubesphere-system
    7. 2. Access the KubeSphere Console
    8. Once the deployment is complete, you can access the KubeSphere console using the following URL:
    9. http://192.168.6.10:30880
    10. 3. Login to KubeSphere Console
    11. Use the following credentials to log in:
    12. Account: admin
    13. Password: P@88w0rd
    14. NOTE: It is highly recommended to change the default password immediately after the first login.
    15. For additional information and details, please visit https://kubesphere.io.

    执行以下命令检查 Pod 状态。

    1. kubectl get pods -n kubesphere-system

    当 Pod 状态都为 Running 时,使用默认的账户和密码 (admin/P@88w0rd) 通过 <NodeIP>:30880 访问 KubeSphere Web 控制台。

    说明

    取决于您的网络环境,您可能需要配置流量转发规则并在防火墙中放行 30880 端口。