KUBERSPHERE安装
注:
在k8s搭建完成的基础上安装最小化kubesphere
1 2 3 4
| 环境:centos7x3 k8s-master 192.168.10.101 2核5G k8s-node1 192.168.10.102 2核2G k8s-node2 192.168.10.103 2核2G
|
kubeadmin安装kubernetes移步阿良大佬的教程
基于kubeadmin搭建,master内存尽量给到7-8个G(我这里环境不允许,期间出现过多次蓝屏)
由于部分包被墙,搭建过程中可能会有许多包拉不下来,建议爬个梯子过去,或者本地翻过去之后给虚拟机做转发
1 2 3 4
| 在yum源存在的情况下 yum -y install openvpn 后台运行 openvpn --daemon --config *.openvpn
|
出现什么什么successfully什么什么completely就ok了
一、安装helm
1.地址 https://helm.sh/docs/intro/install/
1 2 3 4 5 6 7 8
| wget https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz tart -zxvf helm-v3.3.4-linux-amd64.tar.gz mv linux-amd64/helm /usr/local/bin/helm helm version version.BuildInfo{Version:"v3.3.4", GitCommit:"a61ce5633af99708171414353ed49547cf05013d", GitTreeState:"clean", GoVersion:"go1.14.9"}
|
2.命令补全
1 2 3 4 5
| vim ~/.bashrc
source <(helm completion bash)
source ~/.bashrc
|
3.添加常用仓库
1 2 3 4 5 6
| $ helm repo add stable https://kubernetes-charts.storage.googleapis.com/ $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ $ helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx $ helm repo update # Make sure we get the latest list of charts $ helm repo add ali-stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts #阿里云
|
1 2 3 4 5 6 7
| helm repo list
NAME URL ingress-nginx https://kubernetes.github.io/ingress-nginx stable https://kubernetes-charts.storage.googleapis.com/ bitnami https://charts.bitnami.com/bitnami incubator https://kubernetes-charts-incubator.storage.googleapis.com/
|
4.配置权限
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| 权限 kubectl apply -f 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
|
二、安装openebs创建storageclass持久化存储
可移步大佬用nfs做持久化存储案例来了解持久化存储
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| kubectl get node -o wide 去除污点 kubectl describe node master | grep Taint 去除master的污点 kubectl taint nodes master node-role.kubernetes.io/master:NoSchedule-
安装OpenEBS A:若集群已安装了 Helm,可通过 Helm 命令来安装 OpenEBS: kubectl create ns openebs helm install --namespace openebs --name openebs stable/openebs --version 1.5.0 B:除此之外 还可以通过 kubectl 命令安装: kubectl apply -f https://openebs.github.io/charts/openebs-operator-1.5.0.yaml
验证 kubectl get sc 如下将 openebs-hostpath设置为 默认的 StorageClass kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
验证 kubectl get sc
|
三、最小化安装kubesphere
参考官网
1.执行以下命令:
1 2 3
| kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.1.0/kubesphere-installer.yaml kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.1.0/cluster-configuration.yaml
|
2.检查安装日志:
1
| kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
|
3.使用kubectl get pod –all-namespaces,看看是否所有的豆荚,在KubeSphere相关的命名空间运行正常。如果是,请30880通过以下命令检查控制台的端口(默认情况下):
1
| kubectl get svc/ks-console -n kubesphere-system
|
4.查看kubusphere组件
1
| kubectl get pod -n kubesphere-monitoring-system
|
5.登录kubesphere控制台
1 2 3
| Console: http://192.168.10.103:30880 Account: admin Password: P@88w0rd
|