KubeSphere搭建流程

本文最后更新于:2020年12月25日 凌晨

说明

KubeSphere 是在 Kubernetes 之上构建的以应用为中心的多租户容器平台,提供全栈的 IT 自动化运维的能力,简化企业的 DevOps 工作流。KubeSphere 提供了运维友好的向导式操作界面,帮助企业快速构建一个强大和功能丰富的容器云平台。

官方文档

安装

安装helm(master执行)

1
curl -L https://git.io/get_helm.sh | bash

创建权限(master执行)

1
2
# 创建yaml文件
sudo vi helm_rbac.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
1
2
# 应用权限
kubectl apply -f helm_rbac.yaml

安装Tiller(master执行)

1
2
# 初始化
helm init --service-account=tiller --tiller-image=sapcc/tiller:v2.16.3 --history-max 300

安装 OpenEBS 创建 LocalPV 存储类型

​ 参考文档https://kubesphere.com.cn/docs/zh-CN/appendix/install-openebs/

/etc/resolv.conf备份

1
2
3
; generated by /usr/sbin/dhclient-script
search ap-east-1.compute.internal
nameserver 172.31.0.2

安装kubesphere

同步服务器时间

1
2
3
4
5
6
7
8
# 安装chrony
sudo yum -y install chrony
# 修改同步服务器地址为阿里云
sudo sed -i.bak '3,6d' /etc/chrony.conf && sudo sed -i '3cserver ntp1.aliyun.com iburst' /etc/chrony.conf
# 启动chronyd及加入开机自启
sudo systemctl start chronyd && sudo systemctl enable chronyd
# 查看同步状态
chronyc sources

安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
kubectl get pod --all-namespaces
# 删除
helm del --purge ks-openldap
helm del --purge ks-minio && kubectl delete job -n kubesphere-system ks-minio-make-bucket-job
kubectl delete ns kubesphere-controls-system
kubectl delete ns kubesphere-monitoring-system
kubectl delete ns kubesphere-system
kubectl apply -f kubesphere-minimal.yaml
kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/master/kubesphere-minimal.yaml
# 查看日志
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
# 修改安装
kubectl edit cm -n kubesphere-system ks-installer
# 查看污点
kubectl describe node k8s-node1 | grep Taint
# 清除污点
kubectl taint nodes k8s-node1 node-role.kubernetes.io/master:NoSchedule-
# 添加污点
kubectl taint nodes k8s-node1 node-role.kubernetes.io/master=:NoSchedule
# 重装
kubectl delete pod <install> -n kubesphere-system
1
2
3
4
# 修改dns
sudo vi /etc/resolv.conf
# 将replicates改为0,从而停止已经启动的coredns pod,再将replicates改为2,触发coredns重新读取系统配置
kubectl edit deployment coredns -n kube-system

账号密码

Account: admin

Password: P@88w0rd


KubeSphere搭建流程
https://www.magese.com/2020/12/24/KubeSphere搭建流程/
作者
Magese
发布于
2020年12月24日
更新于
2020年12月25日
许可协议