手动安装 Clusternet
本教程将引导您以“最硬核”的方式安装 Clusternet。 您也可以尝试参考 使用Helm安装’Clusternet'进行安装。
这种“最硬核”的方式便于您学习,并理解安装 Clusternet 所需要的每一个任务。
您需要在子集群中部署clusternet-agent
,在父集群中部署clusternet-hub
和clusternet-scheduler
。
在父集群中部署 clusternet-hub
Note on kube-apiserver
Please refer to Kubernetes Version Skew to see whether the Kubernetes versions are supported. Please also note that whether the kube-apiserver running in the parent cluster should be configured with flag--aggregator-reject-forwarding-redirect=false
.接下来,您需要为群集注册创建一个 token,随后会被 clusternet-agent 使用到。bootstrap token
或 service account token
都可以。
如果支持
bootstrapping
身份验证,即在父集群中运行的kube-apiserver
显式地设置了--enable-bootstrap-token-auth=true
,如果父集群中的
kube-apiserver
不支持bootstrapping
身份验证 (例如 k3s) ,--enable-bootstrap-token-auth=false
(缺省为false
),请改用serviceaccount token
。
在父集群中部署 clusternet-scheduler
在父集群中部署 clusternet-controller-manager
(从 v0.15.0 版本起)
在子集群中部署 clusternet-agent
clusternet-agent
在子群集中运行,并帮助将自群集注册到父群集。
clusternet-agent
可以配置以下三种 SyncMode
(通过参数 --cluster-sync-mode
配置),
Push
表示父集群中的所有资源更改,都将由clusternet-hub
自动同步、推送,并应用于子集群。Pull
表示clusternet-agent
将监视、同步和应用父群集中的所有资源更改到子群集。Dual
结合了Push
和Pull
模式. 强烈建议使用此模式,通常和 特性功能AppPusher
一起使用。
特性功能 AppPusher
在 agent
侧工作,主要出于以下两个原因引入,
SyncMode
是不建议在注册后更改的, 这可能会导致设置和行为不一致。这就是为什么强烈建议使用Dual
。 当设置Dual
模式时,AppPusher
提供帮助将Push
模式切换到Pull
模式的方法,而无需更改参数--cluster-sync-mode
,反之亦然。用于安全问题,例如子群集安全风险等。
当子集群禁用特性功能
AppPusher
,父集群不会向其部署任何应用程序, 即使设置了同步模式Push
或Dual
。 此时,此子群集的工作方式类似于Pull
模式。要部署的资源表示为
Description
,您也可以运行自己的控制器来观察变更Description
对象,然后分发和部署资源。
在部署 clusternet-agent
的时候,应提前创建一个 secret
对象,包含着可用于集群注册的 token
。
:pushpin: :pushpin: Note:
如果您是通过service account token验证,请将 07401b.f395accd246ae52d 替换为之前生成的 token
上面的 PARENTURL
是您要注册到的父集群的 apiserver 地址, apiserver
地址必须以 https
开头。目前仅支持 https
。 如果 apiserver
服务器未侦听标准 https 端口 (:443), 请在 URL 中指定端口号,以确保代理连接到正确的端点,对于实例 https://192.168.10.10:6443
。
检查集群注册
请按照 本指南 检查集群注册状态。
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.