kubernetes - cloudflared 出现 "failed to sufficiently increase receive buffer size"错误

标签 kubernetes udp cloudflare rancher rancher-desktop

我有一个由 Rancher Desktop 创建的本地 Kubernetes。我已经部署了一个基于 this tutorial 的名为 Cloudflared Tunnel 。

我最近开始遇到错误:

failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.

请注意,这并不影响 Cloudflared Tunnel 的实际功能,这更像是一个警告。不过,我确实希望能解决这个问题。

我已阅读链接中的内容。但是,这是在 Pod 中运行的,所以我不知道如何修复它。

以下是完整日志:

2023-03-18 00:27:51.450Z 2023-03-18T00:27:51Z INF Starting tunnel tunnelID=c9aa4140-fee8-4862-a479-3c1faacbd816
2023-03-18 00:27:51.450Z 2023-03-18T00:27:51Z INF Version 2023.3.1
2023-03-18 00:27:51.450Z 2023-03-18T00:27:51Z INF GOOS: linux, GOVersion: go1.19.7, GoArch: arm64
2023-03-18 00:27:51.451Z 2023-03-18T00:27:51Z INF Settings: map[config:/etc/cloudflared/config/config.yaml cred-file:/etc/cloudflared/creds/credentials.json credentials-file:/etc/cloudflared/creds/credentials.json metrics:0.0.0.0:2000 no-autoupdate:true]
2023-03-18 00:27:51.453Z 2023-03-18T00:27:51Z INF Generated Connector ID: a2d07b8a-3343-4b28-bbb5-a0cc951d5093
2023-03-18 00:27:51.453Z 2023-03-18T00:27:51Z INF Initial protocol quic
2023-03-18 00:27:51.456Z 2023-03-18T00:27:51Z INF ICMP proxy will use 10.42.0.32 as source for IPv4
2023-03-18 00:27:51.456Z 2023-03-18T00:27:51Z INF ICMP proxy will use fe80::3c91:31ff:fe74:68ee in zone eth0 as source for IPv6
2023-03-18 00:27:51.456Z 2023-03-18T00:27:51Z WRN The user running cloudflared process has a GID (group ID) that is not within ping_group_range. You might need to add that user to a group within that range, or instead update the range to encompass a group the user is already in by modifying /proc/sys/net/ipv4/ping_group_range. Otherwise cloudflared will not be able to ping this network error="Group ID 65532 is not between ping group 1 to 0"
2023-03-18 00:27:51.456Z 2023-03-18T00:27:51Z WRN ICMP proxy feature is disabled error="cannot create ICMPv4 proxy: Group ID 65532 is not between ping group 1 to 0 nor ICMPv6 proxy: socket: permission denied"
2023-03-18 00:27:51.460Z 2023-03-18T00:27:51Z INF Starting Hello World server at 127.0.0.1:34545
2023-03-18 00:27:51.460Z 2023-03-18T00:27:51Z INF Starting metrics server on [::]:2000/metrics
2023-03-18 00:27:51.462Z 2023/03/18 00:27:51 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
2023-03-18 00:27:51.592Z 2023-03-18T00:27:51Z INF Connection ca329025-1f06-4f36-a8b2-27eda979345d registered with protocol: quic connIndex=0 ip=198.41.192.107 location=LAX
2023-03-18 00:27:51.760Z 2023-03-18T00:27:51Z INF Connection a25fdab3-adff-4be5-8eb3-c22d593dfbc5 registered with protocol: quic connIndex=1 ip=198.41.200.193 location=SJC
2023-03-18 00:27:52.670Z 2023-03-18T00:27:52Z INF Connection ef583d03-d123-4e8e-b8ad-37eed817d2da registered with protocol: quic connIndex=2 ip=198.41.200.113 location=SJC
2023-03-18 00:27:53.684Z 2023-03-18T00:27:53Z INF Connection 25609514-8c37-451e-b4ac-1fb9fba2b9b8 registered with protocol: quic connIndex=3 ip=198.41.192.37 location=LAX

最佳答案

我的 cloudflared pod 正在 hm-cloudflared namespace 下运行。

所以我可以通过以下方式获取节点名称:

kubectl get pods -o wide -n hm-cloudflared

NAME                           READY   STATUS             RESTARTS       AGE   IP           NODE                   NOMINATED NODE   READINESS GATES
cloudflared-7cdf78df46-x5fb7   0/1     CrashLoopBackOff   13 (93s ago)   26m   10.42.0.82   lima-rancher-desktop   <none>           <none>

获取 pod 运行的节点名称后,您可以通过 kubectl-plugins ssh 进入 Kubernetes 节点。 :

# Install kubectl-plugins
git clone https://github.com/luksa/kubectl-plugins $HOME/kubectl-plugins
export PATH=$PATH:$HOME/kubectl-plugins

# SSH into the Kubernetes node by kubectl-plugins
kubectl ssh node lima-rancher-desktop

Kubernetes节点内部,基于https://github.com/quic-go/quic-go/wiki/UDP-Receive-Buffer-Size#non-bsd , 我可以通过以下方式增加 UDP 接收缓冲区大小:

sysctl -w net.core.rmem_max=2500000

此命令会将最大接收缓冲区大小增加到大约 2.5 MB。

现在只需重新启动 cloudflared pod,问题就应该消失了!希望它可以帮助将来节省一些人的时间!

关于kubernetes - cloudflared 出现 "failed to sufficiently increase receive buffer size"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75779066/

相关文章:

elasticsearch - kubelet 不会创建指向/var/log/containers 的符号链接(symbolic link)

Kubernetes ALB 入口 : How to expose multiple ports on ingress resource

kubernetes - 如何在 kubernetes 中将命令从 pod 运行到主机

nginx - 如何在端口 80/443 的公共(public)节点 IP 上公开 kubernetes nginx-ingress 服务?

C UDP套接字: Arbitrary setsockopt behavior (with SO_RCVTIMEO)

azure - 将 CloudFlare CDN 与 Azure Blob 存储结合使用

kubernetes - 如何配置 NGINX 入口 Controller 以与 Cloudflare 和 digital ocean 负载均衡器配合使用?

Java UDP 服务器 IP 碎片

sockets - 通过 UDP 套接字的 Google 公共(public) DNS 查询

asp.net-core - 类型名称 'serializeObject' 在类型 'JsonConvert' 中不存在