- 一、前言
- 二、环境准备
- 1、配置k8s集群中的默认存储类型 -- NFS
- a、所有节点
- b、主节点
- c、从节点
- d、配置动态供应的默认存储类
- 2、metrics-server
- 三、安装KubeSphere
- 四、卸载KubeSphere
- 运维(33) CentOS7.6通过Kubeadm部署Kubernetes集群
- 运维(34) K8s使用
本文将基于CentOS Linux release 7.6.1810 (Core)通过Kubernetes最小化安装KubeSphere
二、环境准备可参考 https://kubesphere.io/zh/docs/quick-start/minimal-kubesphere-on-k8s
| 机器 | 说明 |
|---|---|
| 192.168.101.20 | k8s-master |
| 192.168.101.21 | k8s-node1 |
| 192.168.101.22 | k8s-node2 |
# 所有机器安装 yum install -y nfs-utilsb、主节点
# nfs主节点 echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports mkdir -p /nfs/data # 设置开机自启 & 现在启动 -- 远程绑定服务 systemctl enable rpcbind --now # nfs服务 systemctl enable nfs-server --now # 配置生效 exportfs -r # 查看 exportfsc、从节点
# 查看远程机器有哪些目录可以同步 -- 使用master机器ip地址 showmount -e 192.168.101.20 # 执行以下命令挂载 nfs 服务器上的共享目录到本机路径 mkdir -p /nfs/data # 同步远程机器数据 mount -t nfs 192.168.101.20:/nfs/data /nfs/data
测试
# 在任意机器写入一个测试文件 echo "hello nfs" > /nfs/data/test.txt # 在其它机器查看数据 cat /nfs/data/test.txtd、配置动态供应的默认存储类
cat <创建一个PVC测试一下动态供应能力
cat <2、metrics-server 集群指标监控组件。
cat <三、安装KubeSphere # 安装 wget https://github.com/kubesphere/ks-installer/releases/download/v3.2.1/kubesphere-installer.yaml kubectl apply -f kubesphere-installer.yaml wget https://github.com/kubesphere/ks-installer/releases/download/v3.2.1/cluster-configuration.yaml kubectl apply -f cluster-configuration.yaml# 检查安装日志 kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f # 查看所有 Pod 是否在 KubeSphere 的相关命名空间中正常运行 kubectl get pod --all-namespaces # 检查控制台的端口 kubectl get svc/ks-console -n kubesphere-system访问集群任意机器IP:30880
四、卸载KubeSphere
初始账号密码: admin/P@88w0rd
wget https://raw.githubusercontent.com/kubesphere/ks-installer/release-3.1/scripts/kubesphere-delete.sh && sh kubesphere-delete.sh
今日分享语句:
为了未来好一点,现在苦一点有什么。



