istio: Calico eBPF mode leads to readiness probe failures with ambient [fixed in Calico 3.29]
Is this the right place to submit this?
- This is not a security vulnerability or a crashing bug
- This is not a question about how to use Istio
Bug Description
We tested several applications in different namespaces, readiness/liveness probes failed everywhere after labeling ns istio.io/dataplane-mode=ambient
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 33m (x1643 over 10h) kubelet Liveness probe failed: dial tcp 192.168.140.251:1080: i/o timeout
Warning Unhealthy 18m (x5231 over 10h) kubelet Readiness probe failed: dial tcp 192.168.140.251:1080: i/o timeout
Warning BackOff 3m45s (x2064 over 9h) kubelet Back-off restarting failed container --- in pod ---
and recover after unlabeling.
Relevant for 1.22.3 and 1.23.0
Version
istioctl version
client version: 1.23.0
control plane version: 1.23.0
data plane version: 1.23.0 (5 proxies)
kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.4
calicoctl version
Client Version: v3.28.1
Git commit: 601856343
Cluster Version: v3.27.2
Cluster Type: k8s,bgp,kubeadm,kdd
Additional Information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (15 by maintainers)
I merged a fix on our side in master. 3.29 is going to be released soon. I also backported it to 3.28 as well. @kapistka the 3.28 hash release
calico/node:release-v3.28carries the fix unless you want to wait for 3.28.2Thanks everyone, especially @tomastigera !
@tomastigera work fine, thanks
I will try to repro it and dig deeper
@tomastigera So far, I don’t understand the difference between working and non-working apps.
calico-kube-controllers and all calico-nodes restarted.
After
k label ns argocd istio.io/dataplane-mode=ambientcurl instead of kubelet (ns in mesh)
After
k label ns argocd istio.io/dataplane-mode-curl instead of kubelet:Thanks. This makes sense. We do rely on conntrack not being skipped here. We can’t really not rely on it (e.g. by catching the packet on the way back out with iptables and DNAT-ing it to restore the original dest address) because we don’t know the original dest address at that point, and we are in general trying to get out of the business of using heuristics to “guess” the host node IP, since that is generally very fragile and full of corner cases that break (as we have seen in the past).
@tomastigera thanx, it worked for me, but partially! For some apps, probes work, for some they don’t.
Calico does not redirect the packet at the pod’s device to eth0. It sets a mark
0x1000000and afaict the packet continues into host name space and into iptables.cali1f808cfe5dc-E: Traffic is towards host namespace, marking with 0x1000000I think Istio’s expectation is that conntrack will pick up the link-local IP and reverse the SNAT and deliver the packet to the host. This does not happen and the packet is instead routed to eth0 via the default route where we unexpectedly see it again. My hunch is that if you set
bpfHostConntrackBypass=falseinfelixconfigurationthen it will not skip the conntrack on the way back. I do not see the relevant IP rule in the iptables dump above, but I have no reason to double that it is there in raw table (it is on by default) and disables conntrack for the returning packet. Calico does not exclude link local IPs from notrack (which I guess it should 😕 )Is that link-local address assigned to any local interface?
I think this is what you are after here, LMK if not
full.txt
@howardjohn thank for bringing it to Calico maintainers attention! Do you happen to have the bpf logs from the pod’s interface which must come just before the eth0 logs? (perhaps logs for the ingress to the pod as well) Seems like the program attached to the pod’s interface decideds wrongly that the packet should be forwarded to eth0 instead of letting the packet go to the host. This might be due to how
169.254.7.127/32is routed.It is not immediately obvious to me why the packet is ultimately denied on eth0 even though it is on the “accept” path, but that is not the problem here, the packet should not end up there in the first place. It has nothing to do with a policy and a policy allowing link local would not help here.
Trace logs (I did curl instead of kubelet, same thing though. local port 12346, health check port 12345)
DENY(0) == CALI_REASON_UNKNOWN
We don’t have any NetworkPolicies. We use Calico eBPF dataplane mode:
This is how the iptable-tables looks on the node (app is in a mesh, all istio ambient components are deployed). iptables -L
iptables -t nat -L
In the pod in mesh. iptables -L
iptables -t nat -L
istio-cni logs after labeling ns