1. 程式人生 > 實用技巧 >Centos7.7下KubeSphere最小化安裝

Centos7.7下KubeSphere最小化安裝

前置環境

安裝helm和tiller

前提k8s叢集已經搭建好

get_helm.sh

sh get_helm.sh

vi helm_rbac.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system
  
kubectl apply -f helm_rbac.yaml

初始化:

helm init --service-account=tiller --tiller-image=sapcc/tiller:v2.16.3 --history-max 300

是否安裝成功的驗證

kubectl get pods --all-namespaces

如果安裝失敗,刪除重新安裝

kubectl get -n kube-system secrets,sa,clusterrolebinding -o name|grep tiller|xargs kubectl -n kube-system delete
kubectl get all -n kube-system -l app=helm -o name|xargs kubectl delete -n kube-system

version:

helm version

如果發現client和service的版本不一致,執行下面命令保證版本相同

helm init --upgrade

確認master是否有汙點

kubectl describe node k8s-node1 | grep Taint

去除汙點

kubectl taint nodes k8s-node1 node-role.kubernetes.io/master:NoSchedule-

安裝OpenEBS

kubectl create ns openebs
helm install --namespace openebs --name openebs stable/openebs --version 1.5.0
kubectl get pods --all-namespaces

等待幾分鐘,建立完畢

叢集已有儲存型別(StorageClass),執行 kubectl get sc看下當前是否設定了預設的 storageclass

將openebs-hostpath設定為預設的storageClass

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

修改完成後,我們就可以看到openebs-hostpath被設定為預設storageClass

最小化安裝

kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/kubesphere-installer.yaml
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/cluster-configuration.yaml
kubectl get pods --all-namespaces
## 等待ks-installer安裝完畢

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

等待一段時間(網速慢的話可能要十來分鐘),直到出現kubesphere控制檯:

訪問console,輸入出現的account和password,進入首頁,至此安裝成功。

頁面還是蠻炫酷的。