TheRiver | blog

You have reached the world's edge, none but devils play past here

0%

install kubesphere on k8s

原来在gke上面装过很顺利,后面自己kubeadm安装的cluster再安装遇到了一些问题,记录下

步骤

按照官方文档安装就可以了,但是自己这里kubectl get svc/ks-console -n kubesphere-system看不到资源,日志也有报错:Stop if StorageClass was not found。gke环境sc这些默认都给配置好了,自己搭的环境就需要自己折腾了

参考这个链接,里面有处理方式,就是手动加了sc,但这样并不能解决对于我遇到的情况。

我用的rook作为存储插件,手动加sc可以参考:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@master ~]# cat sc.yaml
apiVersion: ceph.rook.io/v1beta1
kind: Pool
metadata:
name: replicapool
namespace: rook-ceph
spec:
replicated:
size: 3
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: block-service
provisioner: ceph.rook.io/block
parameters:
pool: replicapool
#The value of "clusterNamespace" MUST be the same as the one in which your rook cluster exist
# clusterNamespace: rook-ceph

gce下可以参考这个:

1
2
3
4
5
6
7
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gce-sc
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd

另外还需要设置一个default的sc:

1
kubectl patch storageclass gce-sc -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

具体参考这里Change the default StorageClass

最后如下:

1
2
3
[root@master ~]# kubectl get sc --all-namespaces
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
gce-sc (default) kubernetes.io/gce-pd Delete Immediate false 47h

重新安装下kubesphere就ok.

reference

https://kubesphere.io/zh/docs/v3.3/quick-start/minimal-kubesphere-on-k8s/

https://cloud.google.com/sdk/gcloud/reference/container/clusters/create

----------- ending -----------