125. 如何调整 RKE2 CoreDNS 的副本数量

张开发
2026/4/8 1:04:29 15 分钟阅读

分享文章

125. 如何调整 RKE2 CoreDNS 的副本数量
Situation 地理位置You want to adjust the number of CoreDNS replicas in the RKE2 cluster.你需要调整 RKE2 集群中的 CoreDNS 副本数量。Resolution 结局RKE2 manages the number of CoreDNS Pods automatically through the rke2-coredns-autoscaler. Therefore, manually changing the replica count of the CoreDNS Deployment will be automatically overwritten and reverted to a pre-calculated value.RKE2 通过 rke2-coredns-autoscaler 自动管理 CoreDNS Pods 的数量。因此手动更改 CoreDNS 部署的副本数量将被自动覆盖并恢复为预先计算的值。Steps 步骤To apply the changes to the default CoreDNS deployment in RKE2, configure the appropriate helm values with a HelmChartConfig.要在 RKE2 中对默认的 CoreDNS 部署应用更改请使用 HelmChartConfig 配置相应的 helm 值。For standalone RKE2 clusters, add the HelmChartConfig to each rke2-server (control plane) node as a .yaml file in the /var/lib/rancher/rke2/server/manifests directory对于独立的 RKE2 集群可以在 /var/lib/rancher/rke2/server/manifests 目录中 将 HelmChartConfig 作为 .yaml 文件添加到每个 rke2-server 节点For RKE2 clusters provisioned by Rancher, add the HelmChartConfig content when editing the cluster in Cluster Management. Paste/edit the content underCluster Configuration Additional Manifestand save对于 Rancher 配置的 RKE2 集群编辑集群时在集群管理中添加 HelmChartConfig 内容。在集群配置 额外清单下粘贴/编辑内容并保存Examples 示例Configure minimum/maximum number of Pods:配置最小/最大数量的 Podspan stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcodeapiVersion: a>Based on the number of nodes (one Pod per node):根据节点数量每个节点一个 Podspan stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcodeapiVersion: a>Based on CPU cores (one Pod for every 6 cores):基于 CPU 核心每 6 个核心一个 Podspan stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcodeapiVersion: a>Notenode-local-dns can also be an alternative to scaling the CoreDNS pods, as node-local-dns will start a pod on each node and provide other benefits注意node-local-dns 也可以作为扩展 CoreDNS Pods 的替代方案因为 node-local-dns 会在每个节点启动一个 pod并带来其他好处Cause 病因Additional Information 附加信息For more configuration options of RKE2 CoreDNS, please refer to the GitHub: https://github.com/rancher/rke2-charts/tree/main/charts/rke2-coredns/rke2-coredns有关 RKE2 CoreDNS 的更多配置选项请参阅 GitHub https://github.com/rancher/rke2-charts/tree/main/charts/rke2-coredns/rke2-corednsRelated KB articles: 相关知识库文章How to customize rke2-coredns如何自定义 rke2-corednsCustomize Helm Chart values for RKE2 default addons自定义 RKE2 默认插件的 Helm Chart 值Environment 环境A Rancher-provisioned or standalone RKE2 cluster.一个由 Rancher 配置或独立的 RKE2 集群。访问Rancher-K8S解决方案博主企业合作伙伴 https://blog.csdn.net/lidw2009

更多文章