Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

3.2.23. 大型集群的 ARP 缓存调优

在具有大量路由的 OpenShift Container Platform 集群中(超过 net.ipv4.neigh.default.gc_thresh3 的值 65536),您必须增加运行路由器 pod 的集群中每个节点上的 sysctl 变量默认值,以允许 ARP 缓存中更多条目。

当出现问题时,内核信息类似如下:

[ 1738.811139] net_ratelimit: 1045 callbacks suppressed
[ 1743.823136] net_ratelimit: 293 callbacks suppressed

当出现这个问题时,oc 命令可能会因为以下错误开始失败:

Unable to connect to the server: dial tcp: lookup <hostname> on <ip>:<port>: write udp <ip>:<port>-><ip>:<port>: write: invalid argument

要验证 IPv4 的 ARP 条目的实际数量,请运行以下内容:

# ip -4 neigh show nud all | wc -l

如果数字开始接近 net.ipv4.neigh.default.gc_thresh3 阈值,则增加值。运行以下命令来获取当前值:

# sysctl net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh1 = 128
# sysctl net.ipv4.neigh.default.gc_thresh2
net.ipv4.neigh.default.gc_thresh2 = 512
# sysctl net.ipv4.neigh.default.gc_thresh3
net.ipv4.neigh.default.gc_thresh3 = 1024

以下 sysctl 将变量设置为 OpenShift Container Platform 当前默认值。

# sysctl net.ipv4.neigh.default.gc_thresh1=8192
# sysctl net.ipv4.neigh.default.gc_thresh2=32768
# sysctl net.ipv4.neigh.default.gc_thresh3=65536

要使这些设置永久生效,请查看本文档