Kubernetes上安装KubeSphere
安装helm
创建helm文件夹,手动下载helm安装包,放入helm文件夹
tar -zxf helm-v3.2.1-linux-amd64.tar.gz && mv linux-amd64/helm . && rm -rf *linux-amd64*
mv helm /usr/local/bin/
查看helm版本
[root@k8s-master01 3.1.1]# helm version
version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}
安装 OpenEBS
查看 master的污点
kubectl describe node k8s-master01 | grep Taint
去除master的污点
kubectl taint nodes k8s-master01 node-role.kubernetes.io/master:NoSchedule-
添加OpenEBS LocalPV仓库到helm
helm repo add openebs-localpv https://openebs.github.io/dynamic-localpv-provisioner
安装OpenEBS
helm install openebs openebs-localpv/localpv-provisioner --namespace openebs --create-namespace
等待openebs相关pod创建完毕
kubectl get pods -n openebs
查看storageclass
[root@k8s-master01 helm]# kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
openebs-device openebs.io/local Delete WaitForFirstConsumer false 109s
openebs-hostpath openebs.io/local Delete WaitForFirstConsumer false 109s
设置默认sc
kubectl patch storageclass openebs-hostpath -p \'{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}\'
安装 KubeSphere
先贴出安装出错后的卸载方法,创建kubesphere-delete.sh文件
sh kubesphere-delete.sh
在k8s集群的master节点上执行,没反应的话就去手动下载对应文件
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/kubesphere-installer.yaml
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/cluster-configuration.yaml
检查安装日志:
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath=\'{.items[0].metadata.name}\') -f
检查kubesphere所有pod是否成功启动
kubectl get pods --all-namespaces
等待安装完成后,过以下命令检查控制台的端口(默认为 30880)
[root@k8s-master01 kubesphere]# kubectl get svc/ks-console -n kubesphere-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ks-console NodePort 10.99.39.85 <none> 80:30880/TCP 35m
netstat -lntp
确保在安全组中打开了端口 30880
,并通过 NodePort (IP:30880)
使用默认帐户和密码 (admin/P@88w0rd)
访问 Web 控制台
Account: admin
Password: P@88w0rd