istio proxy iptable - how to view these configuration
Istio init container runs and configures ip table of our pod (not node) for us. How can we see these iptable in our pod?
First we need to ensure that our deployment
1. annotated with "sidecar.istio.io/enableCoreDump" = true. For example
2. readOnlyRootFilesystem is configured to false.
Otherwise you're going to run into "Iptables : can't open lock file /run/xtables.lock: Read-only file system".
And then shell into our proxy using the following command
kubectl exec -it service-one-fc878cc5b-kdf82 -c istio-proxy -- /bin/sh
Given that istio has move iptable to iptable-nft, so we should be running these command
sudo nft list ruleset
And you should see the followings:-
sudo iptables-nft -t nat -L -v --line-numbers
Interpreting the results from our outputs:-
PREROUTING
Chain PREROUTING (policy ACCEPT 59 packets, 3540 bytes)
num pkts bytes target prot opt in out source destination
1 59 3540 ISTIO_INBOUND tcp -- any any anywhere anywhere
PREROUTING is part of the NAT table and applies to all inbound packets before routing.
-
Rule #1 sends all TCP traffic to the chain
ISTIO_INBOUND. -
Packet counts (59 packets, 3540 bytes) show how many packets matched this rule.
Effect: Incoming traffic to the pod is evaluated by Istio’s inbound rules.
INPUT Chain
Chain INPUT (policy ACCEPT 59 packets, 3540 bytes)
OUTPUT Chain
OUTPUT handles packets generated by the pod (outbound traffic).
-
All outbound traffic is sent to the
ISTIO_OUTPUTchain.
Effect: All outgoing traffic goes through Envoy sidecar.
ISTIO_INBOUND Chain
Chain ISTIO_INBOUND (1 references)
num pkts bytes target prot opt in out source destination
1 0 0 RETURN tcp -- any any anywhere anywhere tcp dpt:15008
2 0 0 RETURN tcp -- any any anywhere anywhere tcp dpt:15090
3 59 3540 RETURN tcp -- any any anywhere anywhere tcp dpt:15021
4 0 0 RETURN tcp -- any any anywhere anywhere tcp dpt:15020
5 0 0 ISTIO_IN_REDIRECT tcp -- any any anywhere anywhere
RETURN rules (#1-#4): Exclude Envoy health/metrics ports from redirection:
-
15008 → Istio custom port
-
15090 → Envoy metrics
-
15021 → Envoy readiness probe
-
15020 → Envoy statsRule #5: All other inbound traffic goes to
ISTIO_IN_REDIRECT.
ISTIO_IN_REDIRECT Chain
Chain ISTIO_IN_REDIRECT (3 references)
num pkts bytes target prot opt in out source destination
1 0 0 REDIRECT tcp -- any any anywhere anywhere redir ports 15006
REDIRECT to 15006 → Envoy inbound listener port
-
Any inbound traffic not excluded is redirected here.
✅ Effect: App never sees traffic directly; Envoy handles it first.
ISTIO_OUTPUT Chain
Chain ISTIO_OUTPUT (1 references)
num pkts bytes target prot opt in out source destination
...
9 1 68 ISTIO_REDIRECT all -- any any anywhere anywhere
ISTIO_REDIRECT.ISTIO_REDIRECT Chain
Chain ISTIO_REDIRECT (1 references)
num pkts bytes target prot opt in out source destination
1 0 0 REDIRECT tcp -- any any anywhere anywhere redir ports 15001
REDIRECT to 15001 → Envoy outbound listener portAll pod-originated traffic that is not excluded hits Envoy firs
Effect: Outbound traffic flows through Envoy for routing, telemetry, mTLS, etc.
Comments