内容目录
环境
本地安装
centos stream 9
如果您访问 GitHub/Googleapis 受限
参考官方教程:https://kubesphere.io/zh/docs/v3.4/quick-start/all-in-one-on-linux/
https://kubesphere.io/zh/docs/v3.4/installing-on-linux/introduction/multioverview/
遇到问题解决 写文备忘
1.安装相关环境
curl -fsSL https://get.docker.com | bash
systemctl start docker
systemctl enable docker
yum install -y socat conntrack ebtables ipset iproute-tc
如果docker安装报错
- package podman-3:4.6.0-1.module_el8+567+36ff2357.x86_64 from appstream requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3:4.6.1-1.module_el8+643+8db347f4.x86_64 from appstream requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3:4.6.1-2.module_el8+653+feef7bfe.x86_64 from appstream requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3:4.6.1-4.module_el8+664+4072b3ae.x86_64 from appstream requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3:4.6.1-5.module_el8+712+4cd1bd69.x86_64 from appstream requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3:4.6.1-5.module_el8+712+4cd1bd69.x86_64 from @System requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-1.6.4-23.module_el8.4.0+643+ef36beeb.x86_64 from appstream is filtered out by modular filtering
- package podman-3.0.1-13.module_el8.7.0+1217+ea57d1f1.x86_64 from appstream is filtered out by modular filtering
- package podman-3.0.1-6.module_el8.5.0+736+58cc1a5a.x86_64 from appstream is filtered out by modular filtering
- package podman-3.0.1-7.module_el8.6.0+1107+d59a301b.x86_64 from appstream is filtered out by modular filtering
- package podman-2:4.0.0-1.module_el8.6.0+1108+b13568aa.x86_64 from appstream is filtered out by modular filtering
- package podman-2:4.0.2-12.module_el8.8.0+1255+530d102a.x86_64 from appstream is filtered out by modular filtering
- package podman-2:4.0.2-23.module_el8+459+2bdc3b51.x86_64 from appstream is filtered out by modular filtering
- package podman-2:4.0.2-24.module_el8+668+cc1a7ff1.x86_64 from appstream is filtered out by modular filtering
- package podman-2:4.0.2-8.module_el8.7.0+1197+29cf2b8e.x86_64 from appstream is filtered out by modular filtering
执行
yum erase podman buildah
2.下载KK
export KKZONE=cn
curl -fL https://get-kk.kubesphere.io | VERSION=v3.0.13 sh -
国内网络 只能curl -x 通过代理了
export KKZONE=cn
curl -x socks5://192.168.0.248:7890 -fL https://get-kk.kubesphere.io | VERSION=v3.0.13 sh -
3.设置主机名
我准备了三台虚拟机 node1 node2 node3
注意虚拟机核心数需要大于2
否则后面报 [ERROR NumCPU]: the number of available CPUs 1 is less than the required 2
hostnamectl set-hostname node1
/etc/hosts修改
192.168.0.121 node1
192.168.0.122 node2
192.168.0.123 node3
3.同时安装 Kubernetes 和 KubeSphere
自己选的v1.23.17 官方教程说1.23以上版本可能边缘节点不可用
3.1 创建配置文件
./kk create config --with-kubernetes v1.23.17 --with-kubesphere v3.4.1 [-f ~/config-sample.yaml]
如果要装kubesphere企业版先单纯安装k8s
./kk create config --with-kubernetes v1.23.17 [-f ~/config-sample.yaml]
然后参考https://docs.kubesphere.com.cn/v4.0/03-install-and-uninstall/01-install-ks-core/ 安装
3.2 编辑配置文件
vi config-sample.yaml编辑节点
apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: node1, address: 192.168.0.121, internalAddress: 192.168.0.121, user: root, password: "123456"}
- {name: node2, address: 192.168.0.122, internalAddress: 192.168.0.122, user: root, password: "123456"}
- {name: node3, address: 192.168.0.123, internalAddress: 192.168.0.123, user: root, password: "123456"}
roleGroups:
etcd:
- node1
control-plane:
- node1
worker:
- node1
- node2
- node3
注意 默认的配置文件hosts worker 只有两个 记得添加额外的node3
3.3 安装
export KKZONE=cn
./kk create cluster -f config-sample.yaml
成功标志
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.0.121: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 2024-01-16 14:17:26
#####################################################
14:17:29 CST success: [node1]
14:17:29 CST Pipeline[CreateClusterPipeline] execute successfully
Installation is complete.
Please check the result using the command:
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f
4. 添加节点
vi config-sample.yaml
hosts worker各再多加一行
添加节点
export KKZONE=cn
./kk add nodes -f config-sample.yaml
近期评论