环境
  • Rancher v2.6+  牧场主 v2.6+
  • A standalone or Rancher-provisioned RKE2/K3s cluster
    一个独立或牧场配置的 RKE2/K3s 集群
情况

The existing RKE2/K3s cluster's pod limit has been exhausted and needs to be increased.
现有 RKE2/K3s 集群的吊舱数量限制已被耗尽,需要提高。

解决方案

When looking to change the max-pods for a node, make sure to take into account the number of IP addresses available from each nodes node CIDR, as this will limit the number of pods that can be scheduled on a node. Changing the node CIDR config in an existing cluster is not supported. If you need to increase the node-cidr-mask-size (and/or cluster_cidr) you will need to provision a fresh cluster, per the article How to setup your network CIDR for a large cluster.
在更改节点的最大 pod 数量时,务必考虑每个节点节点 CIDR 可用的 IP 地址数量,因为这会限制节点上可调度的 Pod 数量。不支持更改现有集群中的节点 CIDR 配置。如果你需要增加节点 CIDR 掩码大小 (和/或 cluster_cidr),你需要根据文章 《 如何为大型集群设置你的网络 CIDR》来配置一个新的集群。

Standalone RKE2/K3s clusters
独立 RKE2/K3s 集群

In a standalone cluster, the configuration needs to be applied per node:
在独立集群中,配置需要按节点应用:

  1. Configure the kubelet's max-pods argument in the RKE2 or K3s configuration file (/etc/rancher/rke2/config.yaml or /etc/rancher/k3s/config.yaml) per the following example:
    在 RKE2 或 K3s 配置文件(/etc/rancher/rke2/config.yaml 或 /etc/rancher/k3s/config.yaml)中配置 kubelet 的 max-pods 参数,具体示例如下:
    <span style="color:#000000"><span style="background-color:#ffffff"><span style="background-color:#f3f3f3">kubelet-arg:
      - "max-pods=200"</span></span></span>
  2. After updating the configuration file, you will need to restart the RKE2/K3s service to apply the changes:
    更新配置文件后,您需要重启 RKE2/K3s 服务以应用以下更改:
    • On RKE2 server nodes: systemctl restart rke2-server
      在 RKE2 服务器节点上:systemctl restart rke2-server
    • On RKE2 worker nodes: systemctl restart rke2-agent
      On RKE2 worker nodes: systemctl restart rke2-agent
    • On K3s server nodes: systemctl restart k3s
      在 K3s 服务器节点上:systemctl restart k3s
    • On K3s worker nodes: systemctl restart k3s-agent
      On K3s worker nodes: systemctl restart k3s-agent

Rancher-provisioned RKE2/K3s clusters
牧场配置 RKE2/K3s 集群

In a Rancher-provisioned cluster, the configuration can be managed at the cluster-level within Rancher:
在 Rancher 配置的集群中,配置可以在 Rancher 内部的集群层级管理:

  1. Navigate to Cluster Management within the Rancher UI and click Edit Config for the relevant RKE2/K3s cluster
    在 Rancher UI 中进入集群管理 ,点击编辑配置以获取相关的 RKE2/K3s 集群
  2. Under Cluster Configuration click Advanced
    集群配置中点击高级
  3. Under For all machines, use the Kubelet args: in the section Additional Kubelet Args click Add Argument
    在 “For all machine”下,使用 Kubelet 的 args: 在 “Additional Kubelet Args”部分 点击 “添加参数
  4. Enter the desired max-pods value, for example max-pods=200
    输入所需的最大舱数值,例如最大舱数=200
  5. Click Save to apply the change 
    点击保存以应用变更 
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐