KubeSphere 是一个企业级容器平台,使用户能够在 Kubernetes 上部署、管理和扩展容器化应用程序。它为管理 Kubernetes 集群提供了统一的界面,并简化了开发人员的部署过程。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 KubeSphere
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade sudo apt install curl socat conntrack ebtables ipset</span>
第 2 步。安装主机。
现在使用您喜欢的文本编辑器打开文件“”:/etc/hosts
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">hosts</span>
将服务器 IP 地址和主机名的详细信息添加到文件中:
<span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.20</span><span class="pln"> master master </span><span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.121</span><span class="pln"> node1 node1 </span><span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.122</span><span class="pln"> node2 node2</span>
第 3 步。在主节点上安装 KubeKey。
现在通过运行以下命令安装 KubeKey:
<span class="pln">curl </span><span class="pun">-</span><span class="pln">sfL https</span><span class="pun">:</span><span class="com">//get-kk.kubesphere.io | VERSION=v3.0.2 sh -</span>
接下来,使文件“”可执行:kk
<span class="pln">chmod </span><span class="pun">+</span><span class="pln">x kk</span>
下载 KubeKey 后,接下来您将通过 KubeKey 开始配置 Kubernetes 和 Kubesphere 部署。现在生成新的 YAML 配置。在这个例子中,你将生成一个新的 YAML 脚本 ”,并将 Kubernetes 版本指定为 v1.24.2 和 Kubesphere v3.3.2:deployment-kubesphre.yml
<span class="pun">./</span><span class="pln">kk create config </span><span class="pun">-</span><span class="pln">f deployment</span><span class="pun">-</span><span class="pln">kubesphre</span><span class="pun">.</span><span class="pln">yml </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">kubernetes v1</span><span class="pun">.</span><span class="lit">24.2</span> <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">kubesphere v3</span><span class="pun">.</span><span class="lit">3.2</span>
之后,使用您喜欢的文本编辑器打开 YAML 文件“”:deployment-kubesphre.yml
<span class="pln">nano deployment</span><span class="pun">-</span><span class="pln">kubesphre</span><span class="pun">.</span><span class="pln">yml</span>
更改参数 ” 中的群集名称,并更改用于登录到目标服务器的详细主机的 IP 地址、用户和私钥。最后,在“”上,指定将用作控制平面和工作器节点的主机:metadata: testdeployment
roleGroup
<span class="pln">apiVersion</span><span class="pun">:</span><span class="pln"> kubekey</span><span class="pun">.</span><span class="pln">kubesphere</span><span class="pun">.</span><span class="pln">io</span><span class="pun">/</span><span class="pln">v1alpha2 kind</span><span class="pun">:</span> <span class="typ">Cluster</span><span class="pln"> metadata</span><span class="pun">:</span><span class="pln"> name</span><span class="pun">:</span><span class="pln"> testdeployment spec</span><span class="pun">:</span><span class="pln"> hosts</span><span class="pun">:</span> <span class="pun">-</span> <span class="pun">{</span><span class="pln">name</span><span class="pun">:</span><span class="pln"> master</span><span class="pun">,</span><span class="pln"> address</span><span class="pun">:</span> <span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.20</span><span class="pun">,</span><span class="pln"> internalAddress</span><span class="pun">:</span> <span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.20</span><span class="pun">,</span><span class="pln"> user</span><span class="pun">:</span><span class="pln"> ubuntu</span><span class="pun">,</span><span class="pln"> privateKeyPath</span><span class="pun">:</span> <span class="str">"~/.ssh/id_ed25519"</span><span class="pun">}</span> <span class="pun">-</span> <span class="pun">{</span><span class="pln">name</span><span class="pun">:</span><span class="pln"> node1</span><span class="pun">,</span><span class="pln"> address</span><span class="pun">:</span> <span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.121</span><span class="pun">,</span><span class="pln"> internalAddress</span><span class="pun">:</span> <span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.121</span><span class="pun">,</span><span class="pln"> user</span><span class="pun">:</span><span class="pln"> ubuntu</span><span class="pun">,</span><span class="pln"> privateKeyPath</span><span class="pun">:</span> <span class="str">"~/.ssh/id_ed25519"</span><span class="pun">}</span> <span class="pun">-</span> <span class="pun">{</span><span class="pln">name</span><span class="pun">:</span><span class="pln"> node2</span><span class="pun">,</span><span class="pln"> address</span><span class="pun">:</span> <span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.122</span><span class="pun">,</span><span class="pln"> internalAddress</span><span class="pun">:</span> <span class="lit">192.168</span><span class="pun">.</span><span class="lit">77.122</span><span class="pun">,</span><span class="pln"> user</span><span class="pun">:</span><span class="pln"> ubuntu</span><span class="pun">,</span><span class="pln"> privateKeyPath</span><span class="pun">:</span> <span class="str">"~/.ssh/id_ed25519"</span><span class="pun">}</span><span class="pln"> roleGroups</span><span class="pun">:</span><span class="pln"> etcd</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="pln"> master control</span><span class="pun">-</span><span class="pln">plane</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="pln"> master worker</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="pln"> node1 </span><span class="pun">-</span><span class="pln"> node2</span>
保存文件并在完成后退出编辑器。
第 4 步。部署 Kubernetes 和 Kubesphere。
现在运行下面的 Kubekey ” 二进制文件,使用 YAML 文件 ” 开始 Kubernetes 和 Kubesphere 部署。kk
deployment-kubesphre.yml
这将需要 5-10 分钟才能完成部署。
第5步。配置防火墙。
现在我们使用 KubeSphere 设置了一个简单防火墙 (UFW),以允许在默认 Web 端口上公开访问:30880
<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln"> sudo ufw allow </span><span class="lit">30880</span><span class="pln"> sudo ufw enable</span>
第 6 步。访问 KubeSphere Web 界面。
成功安装后,现在打开您的 Web 浏览器并使用 URL 访问 KubeSphere Web UI。您将被重定向到以下页面:http://192.168.77.20:30880/
键入用户作为“”和默认密码“”,然后单击登录。admin
your-strong-passwd
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy 水母系统上安装 KubeSphere 开源容器平台。如需更多帮助或有用信息,我们建议您查看 KubeSphere 官方网站。