Skip to content
标签
欢迎扫码关注公众号

关于 TKE 容器网络插件

创建 TKE 时有三种容器网络插件可供选择[1]

  1. GlobalRouter 模式
  2. VPC-CNI 模式
  3. Cilium-Overlay 模式

Cilium-Overlay 模式只有在混用云上节点和第三方节点时才会用到,所以当时就在 GlobalRouter 模式和 VPC-CNI 模式之间做选择。最终由于 VPC-CNI 模式的网络性能较高,选择了这个模式。

之后用了近两年,一直没有出现什么问题,最近在调整节点规格时才发现新加的服务器仍然有很多资源,但是 Deployment 部署不过去。容器事件中显示了 Insufficient tke.cloud.tencent.com/eni-ip. 错误消息。这才注意到每个节点上都有一个 ENI-IP 的资源限制,可以在 Worker 节点页面看到类似 ENI-IP : 27 / 27 这样的数值。

提了工单才知道 ENI-IP 的限制是不可以修改的,其上限取决于节点的 CPU 核数 [2]。CPU 的核数决定了可绑定的弹性网卡的数量,而每个弹性网卡可绑定的 IP 数量是固定的(TKE 这里是 9 个)。如新加的这一个节点(4C32G),2~6C 对应的最大可绑定辅助弹性网卡数量是 3,最终单节点 Pod IP 上限就是 3 * 9 = 27 个。另外,节点本身以及一些 TKE 组件也会占用几个 IP,导致单个节点实际可用的 IP 在 20 个左右。之前由于多是 2C8G 或者 4C16G 的机器,没有达到这个上限,也就没有发现这个限制。

可惜的是虽然知道了原因,但是由于集群创建后网络模式不可以修改 [1:1],暂时也就只能这样使用了。

暂时的解决方案就是在内容较大的节点上加了一个标签,然后在内存消耗较多的 Deployment 上加了亲和,让其优先调度到这些节点上。

Deployment 清单示例如下:

yaml
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - preference:
                matchExpressions:
                  - key: vm.type
                    operator: In
                    values:
                      - large-memory
              weight: 1

  1. 容器网络概述 ↩︎ ↩︎

  2. VPC-CNI 模式 Pod 数量限制 ↩︎

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.