最小化安装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
重装 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: FalseendpointIps: 192.168.0.7,192.168.0.8,192.168.0.9port: 2379tlsEnable: Truecommon:mysqlVolumeSize: 20GiminioVolumeSize: 20GietcdVolumeSize: 20GiopenldapVolumeSize: 2GiredisVolumSize: 2Gimetrics_server:enabled: Falseconsole:enableMultiLogin: False # enable/disable multi loginport: 30880monitoring:prometheusReplicas: 1prometheusMemoryRequest: 400MiprometheusVolumeSize: 20Gigrafana:enabled: Falselogging:enabled: FalseelasticsearchMasterReplicas: 1elasticsearchDataReplicas: 1logsidecarReplicas: 2elasticsearchMasterVolumeSize: 4GielasticsearchDataVolumeSize: 20GilogMaxAge: 7elkPrefix: logstashcontainersLogMountedPath: ""kibana:enabled: Falseopenpitrix:enabled: Falsedevops:enabled: FalsejenkinsMemoryLim: 2GijenkinsMemoryReq: 1500MijenkinsVolumeSize: 8GijenkinsJavaOpts_Xms: 512mjenkinsJavaOpts_Xmx: 512mjenkinsJavaOpts_MaxRAM: 2gsonarqube:enabled: FalsepostgresqlVolumeSize: 8Giservicemesh:enabled: Falsenotification:enabled: Falsealerting:enabled: Falsekind: ConfigMap
metadata:name: ks-installernamespace: kubesphere-system---
apiVersion: v1
kind: ServiceAccount
metadata:name: ks-installernamespace: kubesphere-system---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:creationTimestamp: nullname: ks-installer
rules:
- apiGroups:- ""resources:- '*'verbs:- '*'
- apiGroups:- appsresources:- '*'verbs:- '*'
- apiGroups:- extensionsresources:- '*'verbs:- '*'
- apiGroups:- batchresources:- '*'verbs:- '*'
- apiGroups:- rbac.authorization.k8s.ioresources:- '*'verbs:- '*'
- apiGroups:- apiregistration.k8s.ioresources:- '*'verbs:- '*'
- apiGroups:- apiextensions.k8s.ioresources:- '*'verbs:- '*'
- apiGroups:- tenant.kubesphere.ioresources:- '*'verbs:- '*'
- apiGroups:- certificates.k8s.ioresources:- '*'verbs:- '*'
- apiGroups:- devops.kubesphere.ioresources:- '*'verbs:- '*'
- apiGroups:- monitoring.coreos.comresources:- '*'verbs:- '*'
- apiGroups:- logging.kubesphere.ioresources:- '*'verbs:- '*'
- apiGroups:- jaegertracing.ioresources:- '*'verbs:- '*'
- apiGroups:- storage.k8s.ioresources:- '*'verbs:- '*'
- apiGroups:- admissionregistration.k8s.ioresources:- '*'verbs:- '*'---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: ks-installer
subjects:
- kind: ServiceAccountname: ks-installernamespace: kubesphere-system
roleRef:kind: ClusterRolename: ks-installerapiGroup: rbac.authorization.k8s.io---
apiVersion: apps/v1
kind: Deployment
metadata:name: ks-installernamespace: kubesphere-systemlabels:app: ks-install
spec:replicas: 1selector:matchLabels:app: ks-installtemplate:metadata:labels:app: ks-installspec:serviceAccountName: ks-installercontainers:- name: installerimage: kubesphere/ks-installer:v2.1.1imagePullPolicy: "Always"
经过上面2次重装后成功: