文章目录
前言
KubeSphere 是一款开源项目,在目前主流容器调度平台 Kubernetes 之上构建的企业级分布式多租户容器管理平台,提供简单易用的操作界面以及向导式操作方式,在降低用户使用容器调度平台学习成本的同时,极大降低开发、测试、运维的日常工作的复杂度。
对于刚接触 KubeSphere 并想快速上手该容器平台的用户,All-in-One 安装模式是最佳的选择,它能够零配置快速部署 KubeSphere 和 Kubernetes。
一、实验资源
基于微软云Azure创建一台Ubuntu 18.04虚拟机
虚拟机名称 | 操作系统 | 实验资源配置 | 实验依赖项 |
---|---|---|---|
allinone-k8s | Ubuntu Server 18.04 LTS | 4 核 vCPU,16 GB 内存,150 GB 磁盘空间 | socat<必选> conntrack<必选> ebtables<可选> ipset<可选> |
二、创建并连接Ubuntu虚拟机
创建Ubuntu虚拟机
配置虚拟机网络信息
查看并创建虚拟机
创建虚拟机完成
查看虚拟机详细信息
通过SSH远程连接虚拟机,开始安装操作
三、下载 KubeKey
安装实验依赖项组件
apt-get install -y socat
apt-get install -y conntrack
apt-get install -y ebtables
apt-get install -y ipset
从 GitHub Release Page 下载 KubeKey 或直接使用以下命令。
curl -sfL https://get-kk.kubesphere.io | VERSION=v2.0.0 sh -
【注】执行以上命令会下载最新版 KubeKey (v2.0.0),可以修改命令中的版本号下载指定版本。
为 kk
添加可执行权限
chmod +x kk
四、All-in-One 安装 Kubernetes 和 KubeSphere
执行一个命令即可进行安装,命令模式如下
./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
若要同时安装 Kubernetes 和 KubeSphere,可参考以下示例命令
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
本实验执行以下命令进行安装,命令如下
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
【注意】
-
安装 KubeSphere 3.2.1 的建议 Kubernetes 版本:1.19.x、1.20.x、1.21.x 或 1.22.x(实验性支持)。如果不指定 Kubernetes 版本,KubeKey 将默认安装 Kubernetes v1.21.5。
-
一般来说,对于 All-in-One 安装,无需更改任何配置。
-
添加标志 --with-kubesphere,则不会部署 KubeSphere,KubeKey 将只安装 Kubernetes。
-
添加标志 --with-kubesphere 时不指定 KubeSphere 版本,则会安装最新版本的 KubeSphere。
-
执行该命令后,KubeKey 将检查安装环境,结果显示在一张表格中。
执行上述命令之后,安装完成。如图所示。
五、验证安装结果信息
检查安装结果
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
**************************************************
Collecting installation results ...
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://10.3.0.5: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-06-12 03:25:13
#####################################################
kubectl get pod --all-namespaces
kubectl version
kubectl cluster-info
六、访问KubeSphere
设置入站安全规则,访问KubeSphere
输入http://<公网IP地址>:30880,进入WEB控制台。
重置登录密码
进入KubeSphere管理界面
查看集群信息整体状态
查看集群节点信息
使用命令行工具,控制当前集群
查看物理资源监控
查看集群基本信息
查看集群监控状态