istio: ambient failures in CNI with microk8s on Ubuntu 22.04 possibly due to ipv6 compatibility addresses

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

I wanted to test Ambient so I updated to 1.22.1 prior to trying and found that pods would get constantly disconnected and reconnected from the network and there was a furious amount of logging, the load on Loki made my system stress hard that it was logging so much.

After enabling Ambient on the namespace being tested the following type of messages were being logged.

Accepting that ipv6 support is in experimental stage I thought you should know anyway as it’s possible the hard failure change between 1.22.0 and 1.22.1 might account for some of this.

It’s been a few days since the last test - I just wanted to be sure I had looked at existing and previous issues plus changes for insight.

Running with stock Calico CNI otherwise - no changes apart from disabling some host internet connectivity (Ubuntu foo) that attempts to do this on all interfaces and produces spurious logged messages related to unreachable peers.

2024-06-09T15:12:59.358527Z  error  ambient  failed to add pod to ipset: test/redis-58db77c5b6-5dl2q failed to add IP ::ffff:10.1.43.8 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-09T15:12:59.358529Z  error  ambient  failed to add pod to ztunnel: failed to add IP ::ffff:10.1.43.8 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-09T15:12:59.358531Z  error  ambient  Failed to handle add event: failed to add IP ::ffff:10.1.43.8 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-09T15:12:59.358625Z  error  cni  istio-cni cmdAdd failed to signal node Istio CNI agent: unable to push CNI event, error was 500
2024-06-09T15:12:59.358662Z  error  cni  istio-cni cmdAdd error: unable to push CNI event, error was 500
2024-06-09T15:12:59.358667Z  error  cni  istio-cni failed with: unable to push CNI event, error was 500
2024-06-09T15:12:59.377452Z  info  ambient  in pod mode - adding pod test/hop-b-7b79c8f74b-8jsfk to ztunnel
2024-06-09T15:12:59.377548Z  error  ambient  failed adding pod hop-b-7b79c8f74b-8jsfk to ipset istio-inpod-probes with ip ::ffff:10.1.43.45, error was failed to add IP ::ffff:10.1.43.45 with and proto 6 to ipset istio-inpod-probes: exist

For reference I have been running Istio for some time on this environment using sidecars with no problem and with CNI enabled using the overrides for the folder mentioned in the microk8s note ala…

    cni:
      cniBinDir: /var/snap/microk8s/current/opt/cni/bin
      cniConfDir: /var/snap/microk8s/current/args/cni-network

Version

andrews@AndrewsiMac ~ % istioctl version
client version: 1.22.1
control plane version: 1.22.1
data plane version: 1.22.1 (10 proxies)
andrews@AndrewsiMac ~ % kubectl version
Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.4
andrews@AndrewsiMac ~ %

Additional Information

n/a at present as my mesh is back without Ambient but can post if necessary when experiencing the problem. I couldn’t risk leaving this enabled due to the write load the logging was creating.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 45 (24 by maintainers)

Commits related to this issue

Most upvoted comments

I reproduced it. on master, same EKS setup, with non-distroless images for debugging. failed to update POD inpod: default/shell-56bd5dbdbf-jxntr failed to add route: permission denied

root@ip-192-168-97-2:/opt/cni/bin# ip route add local 0::0/0 dev lo table 100
Error: IPv6 is disabled on nexthop device.

No, #52127 has to do with startup and the ipset being there in the first place.

This issue is happening well after that, on ip insertion.

@laiminhtrung1997 can you open a new issue please, what you are seeing doesn’t seem related to ipv6 at all.

Dear @howardjohn I am using istio 1.22.3 but the issue related to ipv6 still occurs. The cluster is working normally until I scale in the AWS Auto Scaling Group (ASG) at night when not using it, then I scale out the ASG in the morning, and all the pods are not running with this message

Warning  FailedCreatePodSandBox  2m (x1833 over 101m)  kubelet  (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "897740e91c26cbc6842c4e961f7d417624b2ab7a327c53626bcfa94588e641b0": plugin type="istio-cni" name="istio-cni" failed (add): unable to push CNI event (status code 500): failed to add IP ::ffff:10.100.8.231 with and proto 6 to ipset istio-inpod-probes: exist

The logs from istio-cni-node

2024-07-19T04:12:03.152021Z     info    cni-agent       adding pod to the mesh  ns=namespace-ac name=unchained-http-proxy-5cb9d54ddd-spdt2
2024-07-19T04:12:03.152170Z     error   cni-agent       failed adding pod unchained-http-proxy-5cb9d54ddd-spdt2 to ipset istio-inpod-probes with ip ::ffff:10.100.8.204, error was failed to add IP ::ffff:10.100.8.204 with and proto 6 to ipset istio-inpod-probes: exist
2024-07-19T04:12:03.152183Z     error   cni-agent       failed to add pod to ipset: herculesdev9-ac/unchained-http-proxy-5cb9d54ddd-spdt2 failed to add IP ::ffff:10.100.8.204 with and proto 6 to ipset istio-inpod-probes: exist        ns=herculesdev9-ac name=unchained-http-proxy-5cb9d54ddd-spdt2
2024-07-19T04:12:03.152195Z     error   cni-agent       failed to handle add event: failed to add IP ::ffff:10.100.8.204 with and proto 6 to ipset istio-inpod-probes: exist    ns=namespace-ac name=unchained-http-proxy-5cb9d54ddd-spdt2
2024-07-19T04:12:03.152536Z     error   cni     istio-cni cmdAdd failed to signal node Istio CNI agent: unable to push CNI event (status code 500): failed to add IP ::ffff:10.100.8.204 with and proto 6 to ipset istio-inpod-probes: exist      pod=herculesdev9-ac/unchained-http-proxy-5cb9d54ddd-spdt2

Is this something that can be solved by just disabling V6 entirely, and taking an updated ztunnel dev build that actually supports fully disabling V6?

The latter is the only piece we didn’t have until very recently when @howardjohn added it.

@bleggett made the commit on 30th April but it looks like the 1.22.1 branch didn’t pick that change but has more recent commits.

That’s correct - there is no IPv6 support in 1.22 AFAIK by design, because it’s not stable or (more importantly) covered with automated testing yet. Non-ipv6 fixes have been backported.

Trying to understand if the platform is literally providing these v4-in-v6 addresses or if we are accidentally mapping them

At least in istio-cni we take some pains to always un map them IIRC, so if we have a problem it’s likely just V6 itself.

Technically you can simply use gcr.io/istio-testing/...:latest but there may have been changes to the install charts, so its best to do the whole thing. In this specific case, there have been changes to the charts and some of the bug fixes are in CNI not ztunnel.

Ok so based on all the info here I think all the issues are fixed. @bleggett is working to backport from master to 1.22. Anyone seeing these issues can try out the master builds (https://github.com/istio/istio/wiki/Dev Builds) to verify. Please LMK if there are any issues unfixed on master

Interestingly I’m getting the same issues using 1.22.1, Ambient, and EKS (with Amazon Linux 2 AMIs and IPv4 only subnets).

No custom configuration on the underlying AMIs - sysctls etc.

2024-06-23T16:36:14.298644Z    info    ambient    About to send added pod: 1ddaaf56-fb54-4d72-ab1b-7eeae3d1c8ea to ztunnel: add:{uid:"1ddaaf56-fb54-4d72-ab1b-7eeae3d1c8ea"  workload_info:{name:"psql-retries-28652676-h8g5v"  namespace:"cluster"  service_account:"default"  trust_domain:"cluster.local"}}
2024-06-23T16:37:00.169479Z    warn    ambient    pod psql-retries-28652677-kfpc8 does not appear to have any assigned IPs, not capturing
2024-06-23T16:37:00.610889Z    info    ambient    in pod mode - adding pod cluster/psql-retries-28652677-kfpc8 to ztunnel 
2024-06-23T16:37:00.611051Z    error    ambient    failed adding pod psql-retries-28652677-kfpc8 to ipset istio-inpod-probes with ip ::ffff:192.168.133.163, error was failed to add IP ::ffff:192.168.133.163 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:00.611064Z    error    ambient    failed to add pod to ipset: cluster/psql-retries-28652677-kfpc8 failed to add IP ::ffff:192.168.133.163 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:00.611069Z    error    ambient    failed to add pod to ztunnel: failed to add IP ::ffff:192.168.133.163 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:00.611075Z    error    ambient    Failed to handle add event: failed to add IP ::ffff:192.168.133.163 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:00.611308Z    error    cni    istio-cni cmdAdd failed to signal node Istio CNI agent: unable to push CNI event, error was 500
2024-06-23T16:37:00.611351Z    error    cni    istio-cni cmdAdd error: unable to push CNI event, error was 500
2024-06-23T16:37:00.611360Z    error    cni    istio-cni failed with: unable to push CNI event, error was 500
2024-06-23T16:37:12.309273Z    info    ambient    in pod mode - adding pod cluster/psql-retries-28652677-kfpc8 to ztunnel 
2024-06-23T16:37:12.309451Z    error    ambient    failed adding pod psql-retries-28652677-kfpc8 to ipset istio-inpod-probes with ip ::ffff:192.168.133.164, error was failed to add IP ::ffff:192.168.133.164 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:12.309467Z    error    ambient    failed to add pod to ipset: cluster/psql-retries-28652677-kfpc8 failed to add IP ::ffff:192.168.133.164 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:12.309471Z    error    ambient    failed to add pod to ztunnel: failed to add IP ::ffff:192.168.133.164 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:12.309478Z    error    ambient    Failed to handle add event: failed to add IP ::ffff:192.168.133.164 with and proto 6 to ipset istio-inpod-probes: exist
2024-06-23T16:37:12.309697Z    error    cni    istio-cni cmdAdd failed to signal node Istio CNI agent: unable to push CNI event, error was 500
2024-06-23T16:37:12.309766Z    error    cni    istio-cni cmdAdd error: unable to push CNI event, error was 500
2024-06-23T16:37:12.309784Z    error    cni    istio-cni failed with: unable to push CNI event, error was 500
2024-06-23T16:37:27.317622Z    info    ambient    in pod mode - adding pod cluster/psql-retries-28652677-kfpc8 to ztunnel 

Subsequently, the pod just loops in the ContainerCreating status:

Events:
  Type     Reason                  Age   From               Message
  ----     ------                  ----  ----               -------
  Normal   Scheduled               70s   default-scheduler  Successfully assigned cluster/psql-retries-28652681-gl8zk to ip-192-168-156-231.eu-west-1.compute.internal
  Warning  FailedCreatePodSandBox  70s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "1eaf61990b0c01af004695c9b42baba76c39f8fb700e3b3a18c717
2ffb89f8c2": plugin type="istio-cni" name="istio-cni" failed (add): unable to push CNI event, error was 500
  Warning  FailedCreatePodSandBox  56s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "60a9181505660deb1432018d7faf885077f3b0eda7431a958bd5fe
63e476f02c": plugin type="istio-cni" name="istio-cni" failed (add): unable to push CNI event, error was 500
  Warning  FailedCreatePodSandBox  42s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "8bdb3733df32de0e9099267dae6cb3f7766e5c39db45e69bbf1d1f
6d7afb55ff": plugin type="istio-cni" name="istio-cni" failed (add): unable to push CNI event, error was 500
  Warning  FailedCreatePodSandBox  28s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "c152b2152b9d5acbc2caf69f907ad2d4ff19758ec8bf7b8478d004
27efca85f0": plugin type="istio-cni" name="istio-cni" failed (add): unable to push CNI event, error was 500
  Warning  FailedCreatePodSandBox  15s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "b50c58aa1ed713f495e7a7ec963f0cddb522b246c119de67811cab
a8eddda08e": plugin type="istio-cni" name="istio-cni" failed (add): unable to push CNI event, error was 500

Ok this got me down the wrong path thinking it was IPv6-mapped-IPv4 that is the issue. This is actually https://github.com/istio/istio/pull/51429 I think, which also cleared up the confusing logs

This also applies to the original issue I believe

I’m planning to try to reproduce this on Monday, but in the meantime if someone can show the pod.status.podIps on the pod and maybe ip -j addr it would be good. Trying to understand if the platform is literally providing these v4-in-v6 addresses or if we are accidentally mapping them. I suspect the latter based on another bug I am tracking down