最小化安装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次重装后成功: