Environment  环境
  • SUSE Rancher Prime v2.10.x till v2.11.x
    SUSE Rancher Prime v2.10.x 到 v2.11.x
  • RKE2
  • VMware vSphere
  • AWS EC2
Situation  地理位置
  • After upgrading to Rancher v2.10, VmwarevsphereConfigs created via Terraform (rancher2_machine_config_v2) are automatically deleted after one day if they are not associated with any downstream cluster. This occurs when a machine config is not bound in the Terraform code. There is no alert or notification prior to deletion.
    升级到 Rancher v2.10 后,通过 Terraform (rancher2_machine_config_v2) 创建的 VmwarevsphereConfig 如果没有关联到任何下游集群,通常一天后会自动删除。当机器配置未被绑定在 Terraform 代码中时,就会发生这种情况。删除前没有任何警报或通知。
  • A similar scenario occurs when a Machine Pool is configured through the UI but left without nodes for an extended period. In such cases, Rancher automatically deletes some underlying resources (e.g., vmwarevsphereconfig, amazonec2configs). This causes the pool to become uneditable in the UI and blocks the creation of new pools.
    类似的情况是,当机器池通过界面配置但长时间没有节点时。在这种情况下,Rancher 会自动删除一些底层资源(例如 vmwarevsphereconfig、amazonec2configs)。这会导致该池在界面中变得无法编辑,并阻止新池的创建。
Resolution  结局
  • The deletion of unbound machine configs is an expected behavior in Rancher v2.10+. A cronjob, which runs every 24 hours, deletes machine configs that have no owner references and are older than 1 hour. 
    在 Rancher v2.10+ 中,删除未绑定的机器配置是正常行为。cronjob 每 24 小时运行一次,会删除没有所有者引用且超过 1 小时的机器配置。
  • The cronjob responsible for cleaning up unused machine configs is:
    负责清理未使用机器配置的 cronjob 是:
<span style="color:#000000"><span style="background-color:#ffffff"><span style="background-color:#efefef"><code>kubectl get cronjob -n fleet-default
NAME                                 SCHEDULE    SUSPEND   ACTIVE   LAST SCHEDULE   AGE
rke2-machineconfig-cleanup-cronjob   5 0 * * *   False     0        5h53m           67d</code></span></span></span>
  • However, it will become a problem when an existing pool is scaled down to zero, as it prevents updates to the pool or the creation of new machine pools.
    然而,当现有的池被缩减到零时,这会成为问题,因为这会阻止对池的更新或新的机器池的创建。
  • Staring Rancher v2.12.1 this behavior has been changed. Machine configs in rke-machine-config.cattle.io are added back with ownerReferences when the cluster is edited to modify the node pool.
    Staring Rancher v2.12.1 这种行为已经改变。rke-machine-config.cattle.io 中的机器配置会在编辑集群修改节点池时用 ownerReferences 重新添加。
  • As a workaround in older versions, this issue can be mitigated by suspending the cleanup cronjob.
    在旧版本中,这个问题可以通过暂停清理程序来缓解。
  • The suspension will remain effective until Rancher is restarted and can be applied via:
    暂停将持续有效,直到 Rancher 重新启动,并可通过以下方式实施:
    Rancher → Explore "Local" cluster → More Resources → Batch → Cronjobs → Select "fleet-default" namespace → Suspend
    Rancher → 探索“本地”集群 →更多资源 →批量 → Cronjobs → 选择“fleet-default”命名空间→暂停

Caution: Suspending the cronjob may leave orphaned configurations in the cluster for an extended period.
注意:暂停 cronjob 可能会在集群中留下孤儿配置较长时间。

Cause  病因

The automatic deletion of orphaned machine configs was introduced in Rancher v2.10 as a resource optimization measure. A cronjob was deployed to clean up machine configs that lack owner references and are older than one hour.
自动删除孤立机器配置的功能是在 Rancher v2.10 中引入的,作为资源优化措施。部署了一个 cronjob 来清理那些没有所有者引用且超过一小时的机器配置。

访问Rancher-K8S解决方案博主,企业合作伙伴 :
https://blog.csdn.net/lidw2009

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐