• k8s 集群部署 kubesphere


    一、最小化部署 kubesphere

    1、在已有的 Kubernetes 集群上部署 KubeSphere,下载 YAML 文件:

    wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.0/kubesphere-installer.yaml
    wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.0/cluster-configuration.yaml
    
    • 1
    • 2

    2、执行以下命令部署 kubesphere

    kubectl apply -f kubesphere-installer.yaml
    kubectl apply -f cluster-configuration.yaml
    
    • 1
    • 2

    二、中途遇到的报错及解决方法

    说明:这里基本所有同学都不可能成功安装,因为我们使用的Host Storage存储,因此需要手动创建存储类,会出现以下报错信息:

    fatal: [localhost]: FAILED! => {
        "assertion": "\"(default)\" in default_storage_class_check.stdout",
        "changed": false,
        "evaluated_to": false,
        "msg": "Default StorageClass was not found !"
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    解决方法如下:
    1、创建文件storageclass.yaml

    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: local-storage
    provisioner: kubernetes.io/no-provisioner
    volumeBindingMode: WaitForFirstConsumer
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2、创建文件persistentVolumeClaim.yaml

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: local-pve
    spec:
      accessModes:
         - ReadWriteOnce
      resources:
        requests:
          storage: 20Gi
      storageClassName: local-storage
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    3、修改sc为默认标识为default

    kubectl patch sc local-storage -p '{"metadata": {"annotations": {"storageclass.beta.kubernetes.io/is-default-class": "true"}}}'
    ## local-storage 是 sc 的名称
    
    • 1
    • 2

    三、重新部署 kubesphere

    1、重新执行以下命令即可 kubesphere

    kubectl apply -f kubesphere-installer.yaml
    kubectl apply -f cluster-configuration.yaml
    
    • 1
    • 2

    2、检查安装日志:

    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
    
    • 1

    3、安装完成后,您会看到以下消息:

    #####################################################
    ###              Welcome to KubeSphere!           ###
    #####################################################
    
    Console: http://192.168.122.154: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-09 14:16:39
    #####################################################
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    4、查看pod是否正常运行

    [root@kubernetes-master ~]# kubectl get pod,svc -n kubesphere-system
    NAME                                         READY   STATUS    RESTARTS   AGE
    pod/ks-apiserver-b7ddc4f5c-ss4kz             1/1     Running   0          26h
    pod/ks-console-7c48dd4c9f-n6v7n              1/1     Running   0          26h
    pod/ks-controller-manager-854ff655d4-zpv2f   1/1     Running   0          26h
    pod/ks-installer-6d7d97c687-mw6m5            1/1     Running   0          26h
    
    NAME                            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
    service/ks-apiserver            ClusterIP   10.109.175.154           80/TCP         26h
    service/ks-console              NodePort    10.97.19.79              80:30880/TCP   26h
    service/ks-controller-manager   ClusterIP   10.103.231.3             443/TCP        26h
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    四、登录 kubesphere 控制台

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

  • 相关阅读:
    六月集训(27) 图
    Docker 安装(方法4):使用二进制文件压缩包安装
    CSDN App 2022上半年-栉风沐雨谨慎前行
    ubuntu 定时发送邮件
    最新版nacos 2.2.3服务注册与发现版本依赖问题
    您的captcha验证码设置对了吗?
    武汉新时标文化传媒有限公司新版抖店正式上线
    [LeetCode 1094] 差分数组的本质是动态规划
    关于Web应用和容器的指纹收集以及自动化软件的制作
    DDL相关操作
  • 原文地址:https://blog.csdn.net/ljx1528/article/details/133745731