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

Centos7.7下KubeSphere最小化安装

初始化:

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

Centos7.7下KubeSphere最小化安装

是否安装成功的验证

kubectl get pods --all-namespaces

Centos7.7下KubeSphere最小化安装

如果安装失败,删除重新安装

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

Centos7.7下KubeSphere最小化安装

如果发现client和service的版本不一致,执行下面命令保证版本相同

helm init --upgrade

Centos7.7下KubeSphere最小化安装

确认master是否有污点

kubectl describe node k8s-node1 | grep Taint

Centos7.7下KubeSphere最小化安装

去除污点

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

Centos7.7下KubeSphere最小化安装

安装OpenEBS

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

Centos7.7下KubeSphere最小化安装

等待几分钟,创建完毕

集群已有存储类型(StorageClass),执行 kubectl get sc看下当前是否设置了默认的 storageclass

Centos7.7下KubeSphere最小化安装

将openebs-hostpath设置为默认的storageClass

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

修改完成后,我们就可以看到openebs-hostpath被设置为默认storageClass

Centos7.7下KubeSphere最小化安装

最小化安装

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安装完毕

Centos7.7下KubeSphere最小化安装

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

等待一段时间(网速慢的话可能要十来分钟),直到出现kubesphere控制台:

Centos7.7下KubeSphere最小化安装

访问console,输入出现的account和password,进入首页,至此安装成功。

Centos7.7下KubeSphere最小化安装

页面还是蛮炫酷的。

Centos7.7下KubeSphere最小化安装

上一篇:使用Helm在Kubernetes上部署区块链


下一篇:使用loki+promtail实现云原生日志分析