前提叙述:(配置kubesphere需本机上有pv和pvc、上篇文档中有配置openebs、请先配置openebs后在配置storageclass、安装kubesphere时候会关联storageclass、storageclass会绑定openebs、自动创建pv、pvc、实现持久化存储)
部署kubesphere需配置storageclass实现动态制备、自动创建pv、pvc
storageclass yaml文件如下:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: local
namespace: kube-system
namespace: kubesphere-monitoring-system
annotations:
cas.openebs.io/config: |
- name: StorageType
value: "hostpath"
- name: BasePath
value: "/var/openebs/local/"
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{"cas.openebs.io/config":"-
name: StorageType\n value: \"hostpath\"\n- name: BasePath\n value:
\"/var/openebs/local/\"\n","openebs.io/cas-type":"local","storageclass.beta.kubernetes.io/is-default-class":"true","storageclass.kubesphere.io/supported-access-modes":"[\"ReadWriteMany\"]"},"name":"local"},"provisioner":"openebs.io/local","reclaimPolicy":"Delete","volumeBindingMode":"Immediate"}
openebs.io/cas-type: local
storageclass.beta.kubernetes.io/is-default-class: 'true'
storageclass.kubesphere.io/supported-access-modes: '["ReadWriteMany"]'
provisioner: openebs.io/local
reclaimPolicy: Delete
使用kubectl apply -f storageclass.yaml执行
部署完成storageclass后安装kubesphere
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/kubesphere-installer.yaml
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.4.1/cluster-configuration.yaml
安装后执行: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 进行查看、会显示登录方式、以及账号密码
kubesphere官网安装教程: