istio: ambient: "failed to add pod to ztunnel" on k3s cluster
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
When attempting to run Istio ambient mode on k3s cluster (arm64) using Calico, istio-cni reports the following error when attempting to add pods to the ambient mesh (adding ambient label to namespace):
2024-03-24T23:28:47.457136Z error Command error output: xtables other problem: line 2 failed
2024-03-24T23:28:47.457224Z error iptables failed to restore iptables rules: exit status 1
2024-03-24T23:28:47.457330Z error ambient failed to update POD inpod: default/details-v1-698d88b-n42tz exit status 1
2024-03-24T23:28:47.457353Z error ambient failed to add pod to ztunnel: exit status 1
And the following error when attempting to remove a pod from the mesh (removing ambient label from namespace):
2024-03-24T23:29:01.150318Z warn ambient failed to find pod netns ns=default name=details-v1-698d88b-n42tz
2024-03-24T23:29:01.150381Z error ambient failed to remove pod to ztunnel: failed to find pod netns ns=default name=details-v1-698d88b-n42tz
2024-03-24T23:29:01.156068Z warn ambient failed to find pod netns ns=default name=reviews-v3-5b9bd44f4-tmml8
2024-03-24T23:29:01.156133Z error ambient failed to remove pod to ztunnel: failed to find pod netns ns=default name=reviews-v3-5b9bd44f4-tmml8
Full logs of each event attached, bug-report output attached below.
add-pods.log
remove-pods.log
I see mention of a similar issue in this PR: https://github.com/istio/istio/pull/49231
Istio installed in this example with istioctl install, same issue observed with helm install
Version
$ istioctl version
client version: 1.21.0
control plane version: 1.21.0
data plane version: 1.21.0 (6 proxies)
$ kubectl version
Client Version: v1.29.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.1+k3s2
Additional Information
`istioctl bug-report` output
$ istioctl bug-report
Target cluster context: kubernetes-admin-pico@pico
Running with the following config:
istio-namespace: istio-system
full-secrets: false
timeout (mins): 30
include: { }
exclude: { Namespaces: kube-node-lease,kube-public,kube-system,local-path-storage }
end-time: 2024-03-24 19:30:22.269187089 -0400 EDT
Cluster endpoint: https://pi01.pico.home.arpa:6443
CLI version:
version.BuildInfo{Version:"1.21.0", GitRevision:"Homebrew", GolangVersion:"go1.22.1", BuildStatus:"Homebrew", GitTag:"1.21.0"}
The following Istio control plane revisions/versions were found in the cluster:
Revision default:
&version.MeshInfo{
{
Component: "pilot",
Revision: "default",
Info: version.BuildInfo{Version:"1.21.0", GitRevision:"2ca3e986a683fbdb82dffcd7b2e8d02076a42468", GolangVersion:"", BuildStatus:"Clean", GitTag:"1.21.0"},
},
}
The following proxy revisions/versions were found in the cluster:
Revision default: Versions {1.21.0}
Fetching logs for the following containers:
calico-apiserver/calico-apiserver/calico-apiserver-7d78f674d6-9gxvb/calico-apiserver
calico-apiserver/calico-apiserver/calico-apiserver-7d78f674d6-nmr2b/calico-apiserver
calico-system/calico-kube-controllers/calico-kube-controllers-7978f6997b-bqs6w/calico-kube-controllers
calico-system/calico-node/calico-node-b5mq9/calico-node
calico-system/calico-node/calico-node-nkkpv/calico-node
calico-system/calico-node/calico-node-qrmxf/calico-node
calico-system/calico-node/calico-node-shzl8/calico-node
calico-system/calico-node/calico-node-v8kbf/calico-node
calico-system/calico-typha/calico-typha-86d697f799-8664w/calico-typha
calico-system/calico-typha/calico-typha-86d697f799-msdg4/calico-typha
calico-system/calico-typha/calico-typha-86d697f799-t7x4x/calico-typha
calico-system/csi-node-driver/csi-node-driver-gjdrm/calico-csi
calico-system/csi-node-driver/csi-node-driver-gjdrm/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-mdcc9/calico-csi
calico-system/csi-node-driver/csi-node-driver-mdcc9/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-tx2nk/calico-csi
calico-system/csi-node-driver/csi-node-driver-tx2nk/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-w576d/calico-csi
calico-system/csi-node-driver/csi-node-driver-w576d/csi-node-driver-registrar
calico-system/csi-node-driver/csi-node-driver-wxvc2/calico-csi
calico-system/csi-node-driver/csi-node-driver-wxvc2/csi-node-driver-registrar
default/details-v1/details-v1-698d88b-n42tz/details
default/notsleep/notsleep-5c785bc478-wcnlk/notsleep
default/productpage-v1/productpage-v1-675fc69cf-p7t5z/productpage
default/ratings-v1/ratings-v1-6484c4d9bb-f6nhz/ratings
default/reviews-v1/reviews-v1-5b5d6494f4-6dfqg/reviews
default/reviews-v2/reviews-v2-5b667bcbf8-6m2xh/reviews
default/reviews-v3/reviews-v3-5b9bd44f4-tmml8/reviews
default/sleep/sleep-7656cf8794-cj8sc/sleep
istio-system/bookinfo-gateway-istio/bookinfo-gateway-istio-7755d4897c-lbk5l/istio-proxy
istio-system/istio-cni-node/istio-cni-node-9smjx/install-cni
istio-system/istio-cni-node/istio-cni-node-q99bw/install-cni
istio-system/istio-cni-node/istio-cni-node-wtpdn/install-cni
istio-system/istio-cni-node/istio-cni-node-wwzx8/install-cni
istio-system/istio-cni-node/istio-cni-node-xwgs7/install-cni
istio-system/istiod/istiod-7879855784-9tj5h/discovery
istio-system/ztunnel/ztunnel-4gsgd/istio-proxy
istio-system/ztunnel/ztunnel-5m78r/istio-proxy
istio-system/ztunnel/ztunnel-vwndw/istio-proxy
istio-system/ztunnel/ztunnel-x6xj5/istio-proxy
istio-system/ztunnel/ztunnel-xh6qz/istio-proxy
metallb-system/metallb-controller/metallb-controller-5bfcc7df68-27c6j/controller
metallb-system/metallb-speaker/metallb-speaker-2chn6/speaker
metallb-system/metallb-speaker/metallb-speaker-46zpg/speaker
metallb-system/metallb-speaker/metallb-speaker-fqw8l/speaker
metallb-system/metallb-speaker/metallb-speaker-rh9fm/speaker
metallb-system/metallb-speaker/metallb-speaker-xhlh6/speaker
tigera-operator/tigera-operator/tigera-operator-6d7bbc7b65-gpk6t/tigera-operator
Fetching Istio control plane information from cluster.
Fetching CNI logs from cluster.
Running Istio analyze on all namespaces and report as below:
Analysis Report:
Info [IST0102] (Namespace calico-apiserver) The namespace is not enabled for Istio injection. Run 'kubectl label namespace calico-apiserver istio-injection=enabled' to enable it, or 'kubectl label namespace calico-apiserver istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace calico-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace calico-system istio-injection=enabled' to enable it, or 'kubectl label namespace calico-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace default) The namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace metallb-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace metallb-system istio-injection=enabled' to enable it, or 'kubectl label namespace metallb-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace monitoring) The namespace is not enabled for Istio injection. Run 'kubectl label namespace monitoring istio-injection=enabled' to enable it, or 'kubectl label namespace monitoring istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace tigera-operator) The namespace is not enabled for Istio injection. Run 'kubectl label namespace tigera-operator istio-injection=enabled' to enable it, or 'kubectl label namespace tigera-operator istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0118] (Service calico-apiserver/calico-api) Port name apiserver (port: 443, targetPort: 5443) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service calico-system/calico-kube-controllers-metrics) Port name metrics-port (port: 9094, targetPort: 9094) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service calico-system/calico-typha) Port name calico-typha (port: 5473, targetPort: calico-typha) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service metallb-system/metallb-webhook-service) Port name (port: 443, targetPort: 9443) doesn't follow the naming convention of Istio port.
Creating an archive at /home/gclawes/repos/github.com/istio/istio/bug-report.tar.gz.
Time used for creating the tar file is 429.97106ms.
Cleaning up temporary files in /tmp/bug-report.
Done.
Affected product area
- Ambient
- Docs
- Dual Stack
- Installation
- Networking
- Performance and Scalability
- Extensions and Telemetry
- Security
- Test and Release
- User Experience
- Developer Infrastructure
- Upgrade
- Multi Cluster
- Virtual Machine
- Control Plane Revisions
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 27 (12 by maintainers)
ok, if this or something related crops up again, let us know - thanks!
I’m not seeing this anymore on my setup on
v1.24.1, though again my setup does not use the k3s CNI, so I do not believe the CNI path config for k3s was the source of this issue.I disable the k3s built-in flannel with
--flannel-backend=none --disable-network-policyand install calico viatigera-operator, which uses the standard CNI dirs:versions:
Some strange behavior trying to debug with this last night.
I followed the Ambient Mode guide and just created the
sleeppod and added it to the ambient mesh by labeling the namespace.On
1.21.2I see the iptables error (same as before):istio-1.21.2-failure.txt sample (full file attached)
Notably, it appears to be running the
info ambient in pod mode - adding pod default/sleep-7656cf8794-t4dzs to ztunneloperation twice (more on that below).When I attempt to debug the failed
iptables-restoreviakubectl exec, it returns no error:istio-1.21.2-debugging-exec.txt
This entire
iptables-restoreerror does not appear when I update to1.22.0(clean cluster state, not in-place upgrade). I noticed in1.22.0this operation only attempts to run 1iptables-restorecommand, not 2:istio-1.22.0-success.txt sample (full file attached)
I’m still unable to get traffic to flow between pods on
1.22.0following the Ambient Getting Started guide, but I suspect that may be a different problem, I’ll keep debugging that.istio-1.21.2-failure.txt istio-1.22.0-success.txt
And I am using
1.21.1everywhere (helm charts):Value files:
I believe this works because you are not installing K3S with any CNI, and then installing Calico on top with defaults, which would use its own, more standard default CNI directory.
If you let K3S manage the CNI with one of its bundled offerings, you need the overrides, as it uses nonstandard paths. If you do not, it happens to work, because the K3S nonstandard path is being ignored by the primary CNI you have installed, and the primary CNI’s path happens to be the standard one that Istio expects by default.
I’ll enhance the docs and we can close this out.
Fyi: When I install k3s with this command:
I need to install istio-cni with these values included to startup successfully:
Based on this install, my k3s runs fine with ambient mode 😃
@bleggett Maybe worth to document as well?
cc @bleggett