【Amazon】通过代理连接的方式导入 AWS EKS集群至KubeSphere主容器平台

文章目录

一、设置主集群

如果已经安装了独立的 KubeSphere 集群,可以编辑集群配置,将 clusterRole 的值设置为 host

方式一:使用 Web 控制台

使用 admin 帐户登录控制台,然后进入集群管理 页面上的定制资源定义 ,输入关键字 ClusterConfiguration,然后转到其详情页面。编辑 ks-installer 的 YAML 文件。

方式二:使用 Kubectl命令

bash 复制代码
kubectl edit cc ks-installer -n kubesphere-system
yaml 复制代码
multicluster:
  clusterRole: host
  hostClusterName: kubesphere-master

PS:hostClusterName: kubesphere-master集群名称需要跟主机名保存一致!!!

bash 复制代码
[root@kubesphere-master ~]# kubectl edit cc ks-installer -n kubesphere-system
clusterconfiguration.installer.kubesphere.io/ks-installer edited

在 kubectl 中执行以下命令查看安装过程:

bash 复制代码
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

二、在主集群中设置代理服务地址

  • 执行以下命令来检查服务。
bash 复制代码
kubectl -n kubesphere-system get svc
bash\ 复制代码
[root@kubesphere-master ~]# kubectl -n kubesphere-system get svc
NAME                    TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
ks-apiserver            ClusterIP      10.233.57.31    <none>        80/TCP           126m
ks-console              NodePort       10.233.47.149   <none>        80:30880/TCP     126m
ks-controller-manager   ClusterIP      10.233.42.244   <none>        443/TCP          126m
minio                   ClusterIP      10.233.16.144   <none>        9000/TCP         78m
tower                   LoadBalancer   10.233.7.51     <pending>     8080:31899/TCP   4m10s

由于 EXTERNAL-IP 处于 pending 状态,需要手动设置代理地址。例如,如果公有 IP 地址为 139.198.120.120,则需要将公网 IP 的端口,如30721 转发到 NodeIP:NodePort

proxyPublishAddress 的值添加到 ks-installer 的配置文件中,并按如下所示输入公有 IP 地址(此处示例 139.198.120.120)和端口号。

方式一:使用 Web 控制台

使用 admin 帐户登录控制台,然后进入集群管理 页面上的定制资源定义 ,输入关键字 ClusterConfiguration,然后转到其详情页面。编辑 ks-installer 的 YAML 文件。

方式二:使用 Kubectl命令

bash 复制代码
[root@kubesphere-master ~]# kubectl -n kubesphere-system edit clusterconfiguration ks-installer
clusterconfiguration.installer.kubesphere.io/ks-installer edited

在 kubectl 中执行以下命令查看安装过程:

bash 复制代码
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

三、登录控制台验证

发现,此时该KubeSphere集群已成为主集群。

四、准备成员集群

为了通过主集群 管理成员集群,需要使它们之间的 jwtSecret 相同。因此,首先需要在主集群中执行以下命令来获取它。

bash 复制代码
kubectl -n kubesphere-system get cm kubesphere-config -o yaml | grep -v "apiVersion" | grep jwtSecret

命令输出结果如下所示:

bash 复制代码
jwtSecret: "93ObvPBzq1F1EEUZEydp6eJK8Cn0TqeZ"

如果已经安装了独立的 KubeSphere 集群,可以编辑集群配置,将 clusterRole 的值设置为 member

方式一:使用 Web 控制台

使用 admin 帐户登录控制台,然后进入集群管理 页面上的定制资源定义 ,输入关键字 ClusterConfiguration,然后转到其详情页面。编辑 ks-installer 的 YAML 文件。

方式二:使用 Kubectl命令

bash 复制代码
kubectl edit cc ks-installer -n kubesphere-system
  • ks-installer 的 YAML 文件中对应输入上面所示的 jwtSecret
yaml 复制代码
authentication:
  jwtSecret: 93ObvPBzq1F1EEUZEydp6eJK8Cn0TqeZ
  • 向下滚动并将 clusterRole 的值设置为 member,然后点击确定(如果使用 Web 控制台)使其生效:
yaml 复制代码
multicluster:
  clusterRole: member

:wq保存退出。

bash 复制代码
kubectl edit cc ks-installer -n kubesphere-system
clusterconfiguration.installer.kubesphere.io/ks-installer edited

在 kubectl 中执行以下命令查看安装过程:

bash 复制代码
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

使用 kubectl 来获取安装日志以验证状态。运行以下命令,稍等片刻,如果成员集群已准备就绪,将看到成功的日志返回。

五、导入成员集群

admin 身份登录 KubeSphere 控制台,转到集群管理 页面点击添加集群

导入集群 页面输入要导入的集群的基本信息。您也可以点击右上角的编辑模式 以 YAML 格式查看并编辑基本信息。编辑完成后,点击下一步

bash 复制代码
apiVersion: cluster.kubesphere.io/v1alpha1
kind: Cluster
spec:
  provider: Amazon EKS
  connection:
    type: proxy
    kubeconfig: ''
  joinFederation: true
metadata:
  name: xybeks-cluster
  annotations:
    kubesphere.io/alias-name: xybeks-cluster
    kubesphere.io/description: xybeks-cluster
  labels:
    cluster.kubesphere.io/group: demo

连接方式 ,选择集群连接代理 ,然后点击创建。主集群为代理部署 (Deployment) 生成的 YAML 配置文件会显示在控制台上。

根据指示在成员集群中创建一个 agent.yaml 文件,然后将代理部署复制并粘贴到该文件中。在该节点上执行 kubectl create -f agent.yaml 然后等待代理启动并运行。请确保成员集群可以访问代理地址。

bash 复制代码
[root@awseksec2 ~]# vim agent.yaml
[root@awseksec2 ~]# kubectl create -f agent.yaml
deployment.apps/cluster-agent created

待集群代理启动并运行,会看到成员集群已经导入主集群。

六、参考资料

🕹️ 导入 AWS EKS 集群 (kubesphere.io)

相关推荐
ai小陈2 天前
大模型推理显存不够怎么办?量化、KV Cache与CPU Offload优化实战
大数据·人工智能·ai·云计算·gpu算力
@HNUSTer2 天前
基于 GEE 的 Sentinel-2 多光谱数据实现河流浊度指数(NDTI)遥感监测
云计算·数据集·遥感大数据·gee·云平台·河流浊度(ndti)·水质遥感反演
DolitD2 天前
云流技术深度剖析:单服务器下如何实现3D应用的多实例并发?
java·服务器·前端·3d·云原生·云计算
小马同学-2 天前
四、虚拟化技术
运维·云计算
Lifangyun_WD2 天前
第一次租 GPU 服务器怎么开始?镜像、SSH、数据存储和停机前要做什么
服务器·云计算·gpu算力·gpu算力租赁
Huazhongzhanhui2 天前
极智防护与绿色表改:2026中国(武汉)国际表面处理展览会涂装涂料展会前瞻
人工智能·云计算
workflower3 天前
人形机器人灵巧手产业链
人工智能·设计模式·机器人·云计算·无人机
翼龙云_cloud3 天前
阿里云国际渠道代理商:如何在ECS上部署Flask应用?
运维·数据库·阿里云·flask·云计算
Eric.463 天前
秋叶ComfyUI-AKI最新整合包|完整部署教程+核心指令手册
云计算·百度云·comfyui·ai漫剧
NJCloud3 天前
OpenStack(四)——进阶篇之私有网络配置与块存储服务(Cinder)部署
linux·网络·云计算·openstack