calico: High CPU load due to XDP program in iptables
Expected Behavior
Calico using a reasonable amount of CPU. No XDP/BPF related error logs in calico-node.
Current Behavior
Calico using about 10x times it’s usual CPU. In calico-node logs, I can see messages like
[INFO][60] felix/int_dataplane.go 2154: Applying XDP actions did not succeed, disabling XDP error=failed to resync: failed to load BPF program (/usr/lib/calico/bpf/filter.o): stat /sys/fs/bpf/calico/xdp/prefilter_v1_calico_tmp_A: no such file or directory
libbpf: Error loading BTF: Invalid argument(22)
Possible Solution
If I rebuild calico-node using an up-to-date version of bpftool (tried with v7.4 and worked), the issue is gone.
Steps to Reproduce (for bugs)
Not sure about how to reproduce. It happens in our env… and it was introduced by updates to map definitions in https://github.com/projectcalico/calico/pull/8610.
Context
We can not use affected versions of Calico due to the high CPU load (and of course we aren’t sure what other issues could arise)
Your Environment
Calico v3.27.3 and/or v3.28.0.
K8s 1.28 + Ubuntu 20.04.6 workers with 5.4.0-177-generic kernel.
More details
I could confirm that this issue was introduced by this PR: https://github.com/projectcalico/calico/pull/8610. It is present in Calico v3.27.3 and v3.28.0. If I revert the PR, and build my own calico-node image on top of v3.28.0, the issue is gone. Also, if I rebuild calico-node with an up-to-date version of bpftool (tried with v7.4 and worked), the issue is gone.
Related slack thread: https://calicousers.slack.com/archives/CPTH1KS00/p1713552425270619
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 31 (22 by maintainers)
Commits related to this issue
- [release/v1.8] Update calico CNI to fix CPU issues ref: https://github.com/projectcalico/calico/issues/8856 Signed-off-by: Artiom Diomin <artiom@kubermatic.com> — committed to kron4eg/kubeone by kron4eg 2 years ago
- [release/v1.8] Update calico CNI to fix CPU issues (#3326) ref: https://github.com/projectcalico/calico/issues/8856 Signed-off-by: Artiom Diomin <artiom@kubermatic.com> — committed to kubermatic/kubeone by kron4eg 2 years ago
@mihivagyok we are in the process of releasing 3.28.1 atm. It most likely will be released early next week.
@isugimpy we will definitely backport it to v3.28, and also v3.27. However, this issue is not relevant to eBPF dataplane. The issue discussed here is about XDP used in iptables dataplane. eBPF dataplane is NOT affected.
Closing since the fixes (including back ports to v3.27 and v3.28) are merged now, and will be available in the next patch releases.
can confirm this fixed the issue for me as well.
3.25, checked that there where no matches forXDP actions did not succeedstring, as I tested in a previous post.3.28(using this upgrade path) and verified that the string was present and flooding.upgrade.yamlfile to include the image provided by @dzacball, applied it and verified that after the image was set in place and the pods restarted, the log flooding stopped.@mazdakn I tested your image - it works, issue is gone. (As I already mentioned, I also did some tests a few weeks back with a self-built image, using v3.28.0 + latest bpftool, worked as well)
@mazdakn I can verify that if I set
xdpEnabledtofalse, the issue is gone.@dzacball 3.28.1 is planned to be released in the second half of July.
Yes, with vanilla 3.28 image.
@spacegaucho Thanks for being OK to test it. I’ll provide you an image with the updated
bpftool.@spacegaucho similar stuff here:
Could you check your calico-node logs to see if ther’s anything like the logs below?
Just to make sure it’s not specific to a combination of HEPs/GNPs/NetworkSets, I created a cluster with
v3.27.3and deleted all related resources. After that, I restarted calico-node, and the issue is still present:Worker env: