最小化安装Kubesphere报错问题解决方法

文章讲述了在安装Kubesphere时遇到的错误,涉及到默认StorageClass未找到的问题,解决方法是检查并移除master节点的Taint,以及在遇到错误后通过删除组件并重新应用yaml配置来完成安装过程。
摘要由CSDN通过智能技术生成

最小化安装Kubesphere报错:

TASK [preinstall : Stop if defaultStorageClass was not found] ******************
fatal: [localhost]: FAILED! => {
    "assertion": "\"(default)\" in default_storage_class_check.stdout", 
    "changed": false, 
    "evaluated_to": false, 
    "msg": "Default StorageClass was not found !"
}

解决方法:

删除 kubesphere 组件重装:

[root@k8snode1 ~]# kubectl get deploy -n kubesphere-system
NAME           READY   UP-TO-DATE   AVAILABLE   AGE
ks-installer   1/1     1            1           12m
[root@k8snode1 ~]# kubectl delete deploy ks-installer -n kubesphere-system
deployment.extensions "ks-installer" deleted
[root@k8snode1 ~]#

注:多试几次可以解决这个报错。
安装 kubesphere 的时候要确保 master 节点没有 Taint。参考:https://v2-1.docs.kubesphere.io/docs/zh-CN/appendix/install-openebs/

确认 master 节点是否有 Taint,如下看到 master 节点有 Taint。

$ kubectl describe node master | grep Taint
Taints:             node-role.kubernetes.io/master:NoSchedule

去掉 master 节点的 Taint:

$ kubectl taint nodes master node-role.kubernetes.io/master:NoSchedule-

重装:

[root@k8snode1 ~]# kubectl apply -f kubesphere-mini.yaml 
namespace/kubesphere-system unchanged
configmap/ks-installer unchanged
serviceaccount/ks-installer unchanged
clusterrole.rbac.authorization.k8s.io/ks-installer configured
clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged
deployment.apps/ks-installer created
[root@k8snode1 ~]# 

在这里插入图片描述

注:kubesphere-mini.yaml 从这里下载 https://raw.githubusercontent.com/kubesphere/ks-installer/v2.1.1/kubesphere-complete-setup.yaml

使用这条命令查看安装进度:

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

重装 kubesphere 遇到第二个报错:

忘记把错误日志记录下来了。。。
[root@k8snode1 ~]# kubectl get deploy -n kubesphere-system
NAME           READY   UP-TO-DATE   AVAILABLE   AGE
ks-installer   1/1     1            1           12m
redis          0/1     1            0           10m
[root@k8snode1 ~]# 

解决方法:
还是删除 kubesphere 组件,再次重装:

[root@k8snode1 ~]# kubectl delete deploy ks-installer -n kubesphere-system
deployment.extensions "ks-installer" deleted
[root@k8snode1 ~]# 
[root@k8snode1 ~]# kubectl delete deploy redis -n kubesphere-system
deployment.extensions "redis" deleted
[root@k8snode1 ~]# 

注: 安装 kubesphere 的时候要确保 master 节点没有 Taint。参考:https://v2-1.docs.kubesphere.io/docs/zh-CN/appendix/install-openebs/

重装:

[root@k8snode1 ~]# kubectl apply -f kubesphere-mini.yaml 
namespace/kubesphere-system unchanged
configmap/ks-installer unchanged
serviceaccount/ks-installer unchanged
clusterrole.rbac.authorization.k8s.io/ks-installer configured
clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged
deployment.apps/ks-installer created
[root@k8snode1 ~]# 

在这里插入图片描述

注:kubesphere-mini.yaml 从这里下载 https://raw.githubusercontent.com/kubesphere/ks-installer/v2.1.1/kubesphere-complete-setup.yaml

kubesphere-mini.yaml 文件内容:

---
apiVersion: v1
kind: Namespace
metadata:
  name: kubesphere-system

---
apiVersion: v1
data:
  ks-config.yaml: |
    ---

    persistence:
      storageClass: ""

    etcd:
      monitoring: False
      endpointIps: 192.168.0.7,192.168.0.8,192.168.0.9
      port: 2379
      tlsEnable: True

    common:
      mysqlVolumeSize: 20Gi
      minioVolumeSize: 20Gi
      etcdVolumeSize: 20Gi
      openldapVolumeSize: 2Gi
      redisVolumSize: 2Gi

    metrics_server:
      enabled: False

    console:
      enableMultiLogin: False  # enable/disable multi login
      port: 30880

    monitoring:
      prometheusReplicas: 1
      prometheusMemoryRequest: 400Mi
      prometheusVolumeSize: 20Gi
      grafana:
        enabled: False

    logging:
      enabled: False
      elasticsearchMasterReplicas: 1
      elasticsearchDataReplicas: 1
      logsidecarReplicas: 2
      elasticsearchMasterVolumeSize: 4Gi
      elasticsearchDataVolumeSize: 20Gi
      logMaxAge: 7
      elkPrefix: logstash
      containersLogMountedPath: ""
      kibana:
        enabled: False

    openpitrix:
      enabled: False

    devops:
      enabled: False
      jenkinsMemoryLim: 2Gi
      jenkinsMemoryReq: 1500Mi
      jenkinsVolumeSize: 8Gi
      jenkinsJavaOpts_Xms: 512m
      jenkinsJavaOpts_Xmx: 512m
      jenkinsJavaOpts_MaxRAM: 2g
      sonarqube:
        enabled: False
        postgresqlVolumeSize: 8Gi

    servicemesh:
      enabled: False

    notification:
      enabled: False

    alerting:
      enabled: False

kind: ConfigMap
metadata:
  name: ks-installer
  namespace: kubesphere-system

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: ks-installer
  namespace: kubesphere-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  creationTimestamp: null
  name: ks-installer
rules:
- apiGroups:
  - ""
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apps
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - extensions
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - batch
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - rbac.authorization.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apiregistration.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - tenant.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - certificates.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - devops.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - monitoring.coreos.com
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - logging.kubesphere.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - jaegertracing.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - storage.k8s.io
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - '*'
  verbs:
  - '*'

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: ks-installer
subjects:
- kind: ServiceAccount
  name: ks-installer
  namespace: kubesphere-system
roleRef:
  kind: ClusterRole
  name: ks-installer
  apiGroup: rbac.authorization.k8s.io

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ks-installer
  namespace: kubesphere-system
  labels:
    app: ks-install
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ks-install
  template:
    metadata:
      labels:
        app: ks-install
    spec:
      serviceAccountName: ks-installer
      containers:
      - name: installer
        image: kubesphere/ks-installer:v2.1.1
        imagePullPolicy: "Always"


经过上面2次重装后成功:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值