环境安装
- 安装helm
- 安装tiller
安装所需yml文件 :https://download.csdn.net/download/qq_29385297/86904258
相关yml文件都放入linux目录中,并在该目录中执行命令行
安装helm
sh get_helm.sh
cp linux-amd64/helm /usr/local/bin
cp linux-amd64/tiller /usr/local/bin
kubectl apply -f helm-rbac.yaml
helm init --service-account tiller --upgrade \
-i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.17.0 \
--stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm version
安装 OpenEBS
它是k8s的存储类型StorageClass,因为集群里没有StorageClass,所以我们安装OpenEBS作为StorageClass,且必须手动指定默认是它
仅需要在master执行,因为他是存储
# 去掉污点
kubectl describe node k8s-1 | grep Taint
# 输出 Taints: node-role.kubernetes.io/master:NoSchedule
kubectl taint nodes k8s-1 node-role.kubernetes.io/master:NoSchedule-
kubectl describe node k8s-1 | grep Taint
kubectl create ns openebs
kubectl apply -f openebs-operator-1.5.0.yaml
#查看storageclass
kubectl get sc
# 显示false和Delete正常
# 设置默认storageclass
kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
# 验证
kubectl get pod -n openebs
kubectl get sc
安装kubesphere
准备工作
- 您的 Kubernetes 版本必须为:v1.19.x,v1.20.x,v1.21.x,v1.22.x(实验性支持)或 v1.23.x(实验性支持)。
- 确保您的机器满足最低硬件要求:CPU > 1 核,内存 > 2 GB。
- 在安装之前,需要配置 Kubernetes 集群中的默认存储类型。
1、在集群节点中运行 kubectl version
,确保 Kubernetes 版本可兼容
kubectl version
2、检查集群中的可用资源是否满足最低要求
$ free -g
total used free shared buff/cache available
Mem: 16 4 10 0 3 2
Swap: 0 0 0
3、检查集群中是否有默认 StorageClass(准备默认 StorageClass 是安装 KubeSphere 的前提条件)。
$ kubectl get sc
NAME PROVISIONER AGE
glusterfs (default) kubernetes.io/glusterfs 3d4h
安装kubesphere
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml
监控ks安装进度、是否正常
#使用如下命令监控
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
正确输出内容为:
PLAY RECAP *********************************************************************
localhost : ok=31 changed=23 unreachable=0 failed=0 skipped=14 rescued=0 ignored=0
Start installing monitoring
Start installing multicluster
Start installing openpitrix
Start installing network
**************************************************
Waiting for all tasks to be completed ...
task network status is successful (1/4)
task openpitrix status is successful (2/4)
task multicluster status is successful (3/4)
task monitoring status is successful (4/4)
**************************************************
Collecting installation results ...
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.19.139:30880
Account: admin
Password: P@88w0rd
NOTES:
1. After you log into the console, please check the
monitoring status of service components in
"Cluster Management". If any service is not
ready, please wait patiently until all components
are up and running.
2. Please change the default password after login.
#####################################################
https://kubesphere.io 2022-11-04 10:35:49
#####################################################
卸载kubeSphere
只要上面没有出现成功页面,都要通过该脚本删除
kubectl delete -f kubesphere-minimal.yaml