对于那些刚接触 KubeSphere 的并且想快速上手的用户,all-in-one 安装模式是最佳的选择,它能够帮助您零配置快速部署 KubeSphere 和 Kubernetes。
前提条件
建议的机器硬件配置
操作系统 | 最低要求 |
---|---|
Ubuntu 16.04, 18.04 | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
Debian Buster, Stretch | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
CentOS 7.x | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
Red Hat Enterprise Linux 7 | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
SUSE Linux Enterprise Server 15/openSUSE Leap 15.2 | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
备注
上面的系统要求和下面的说明适用于没有启用任何可选组件的默认最小安装。
如果您的计算机是 8C16G 及以上,则建议启用所有组件。
节点的要求
-
节点必须能够通过
SSH
连接。 -
节点上可以使用
sudo
、curl
、openssl
命令。 -
您可以预先自行安装
docker
或者通过下面步骤的 KubeKey 安装。备注
如果您想离线安装 KubeSphere,那么必须预先安装好
docker
。
需要安装的依赖项
socat安装 [必须]
[root@kube-sphere kube-sphere]# yum -y install socat
conntrack-tools 安装 [必须]
[root@kube-sphere kube-sphere]# yum -y install conntrack-tools
ebtables 安装 [可选但建议] (2.6内核已经包含)
[root@kube-sphere kube-sphere]# yum -y install ebtables
ipset 安装 [可选但建议] (2.6内核已经包含)
[root@kube-sphere kube-sphere]# yum -y install ipset
nfs client 安装[可选但建议]
yum -y install nfs-utils ntpdate ntp-doc ntpdate 0.us.pool.ntp.org
ceph client [可选但建议]
glusterfs client [可选但建议]
安装glusterfs
yum install centos-release-gluster
yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma
启动gluster服务
systemctl start glusterd.service
systemctl enable glusterd.service
网络和 DNS 配置
- 必须确保
/etc/resolv.conf
中的 DNS 配置是可用的,不然集群中的 DNS 可能会有问题。 - 如果您的网络配置使用了防火墙或安全组,则必须确保基础组件可以通过特定端口相互通信,可以根据文档需要开放的端口的指导将防火墙关闭。
提示
- 建议操作系统处于干净的状态(不安装任何其他软件),否则可能会发生冲突。
- 如果您无法从 dockerhub.io 下载容器镜像,建议提前准备好容器镜像或者配置镜像加速器。参考加速安装的配置。
开始安装
下载 KubeKey
wget -c https://kubesphere.io/download/kubekey-v1.0.0-linux-amd64.tar.gz -O - | tar -xz
添加可执行权限:
chmod +x kk
安装 KubeSphere
只需执行一个命令即可进行安装,其模板如下所示:
./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
下面示例创建安装了 KubeSphere 的 Kubernetes 集群供您参考:
./kk create cluster --with-kubernetes v1.17.9 --with-kubesphere v3.0.0
备注
- 支持的 Kubernetes 版本: v1.15.12, v1.16.13, v1.17.9 (默认), v1.18.6.
- 一般来说,对于 all-in-one 安装,您无需更改任何配置。
- KubeKey 会默认安装 OpenEBS 为开发和测试环境提供 LocalPV,这对用户来说是非常方便的。
执行该命令后,将看到下面的表格,用于环境检查。
确保安装了上面标有 y
的组件,并输入 yes
继续。
验证安装结果
当看到以下输出时,表明安装已经完成。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-szRsrTgB-1610380653876)(https://ap3.qingstor.com/kubesphere-website/docs/Installation-complete.png)]
输入以下命令以检查安装结果。
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
输出会显示 Web 控制台的 IP 地址和端口号,默认的 NodePort 是 30880
。现在可以使用默认的帐户和密码(admin /P@88w0rd
)通过 EIP:30880
访问控制台。
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.0.2:30880
Account: admin
Password: P@88w0rd
NOTES:
1. After logging into the console, please check the
monitoring status of service components in
the "Cluster Management". If any service is not
ready, please wait patiently until all components
are ready.
2. Please modify the default password after login.
#####################################################
https://kubesphere.io 20xx-xx-xx xx:xx:xx
#####################################################
备注
您可能需要在环境中绑定 EIP
并配置端口转发,以供外部用户访问控制台。此外,确保在安全组中打开了 30880
端口。
检查完上面的安装日志后,可以到 Components 中确认各个组件的安装状态。如果要使用相关服务,可能需要等待某些组件启动并运行。您也可以使用 kubectl get pod --all-namespaces
来检查 KubeSphere 相关组件的运行状况。