Debugging Envoy and Istiod
Istio provides two very valuable commands to help diagnose traffic management configuration problems, the proxy-status
and proxy-config
commands. The proxy-status
command allows you to get an overview of your mesh and identify the proxy causing the problem. Then proxy-config
can be used to inspect Envoy configuration and diagnose the issue.
If you want to try the commands described below, you can either:
- Have a Kubernetes cluster with Istio and Bookinfo installed (as described in installation steps and Bookinfo installation steps).
OR
- Use similar commands against your own application running in a Kubernetes cluster.
Get an overview of your mesh
The proxy-status
command allows you to get an overview of your mesh. If you suspect one of your sidecars isn’t receiving configuration or is out of sync then proxy-status
will tell you this.
$ istioctl proxy-status
NAME CDS LDS EDS RDS PILOT VERSION
details-v1-6fc55d65c9-x6qz8.default SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
istio-ingressgateway-74f5cf489f-xqcnh.istio-system SYNCED SYNCED SYNCED NOT SENT istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
productpage-v1-7f44c4d57c-5f99x.default SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
prometheus-68b46fc8bb-dc965.istio-system SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
ratings-v1-6f855c5fff-mlqmv.default SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
reviews-v1-54b8794ddf-tc8hd.default SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
reviews-v2-c4d6568f9-4flql.default SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
reviews-v3-7f66977689-hwknn.default SYNCED SYNCED SYNCED SYNCED istiod-56b6dd58dd-fx5tx 1.6.0-rc.2
If a proxy is missing from this list it means that it is not currently connected to a Istiod instance so will not be receiving any configuration.
SYNCED
means that Envoy has acknowledged the last configuration Istiod has sent to it.NOT SENT
means that Istiod hasn’t sent anything to Envoy. This usually is because Istiod has nothing to send.STALE
means that Istiod has sent an update to Envoy but has not received an acknowledgement. This usually indicates a networking issue between Envoy and Istiod or a bug with Istio itself.
Retrieve diffs between Envoy and Istiod
The proxy-status
command can also be used to retrieve a diff between the configuration Envoy has loaded and the configuration Istiod would send, by providing a proxy ID. This can help you determine exactly what is out of sync and where the issue may lie.
$ istioctl proxy-status details-v1-6dcc6fbb9d-wsjz4.default
--- Istiod Clusters
+++ Envoy Clusters
@@ -374,36 +374,14 @@
"edsClusterConfig": {
"edsConfig": {
"ads": {
}
},
"serviceName": "outbound|443||public-cr0bdc785ce3f14722918080a97e1f26be-alb1.kube-system.svc.cluster.local"
- },
- "connectTimeout": "1.000s",
- "circuitBreakers": {
- "thresholds": [
- {
-
- }
- ]
- }
- }
- },
- {
- "cluster": {
- "name": "outbound|53||kube-dns.kube-system.svc.cluster.local",
- "type": "EDS",
- "edsClusterConfig": {
- "edsConfig": {
- "ads": {
-
- }
- },
- "serviceName": "outbound|53||kube-dns.kube-system.svc.cluster.local"
},
"connectTimeout": "1.000s",
"circuitBreakers": {
"thresholds": [
{
}
Listeners Match
Routes Match
Here you can see that the listeners and routes match but the clusters are out of sync.
Deep dive into Envoy configuration
The proxy-config
command can be used to see how a given Envoy instance is configured. This can then be used to pinpoint any issues you are unable to detect by just looking through your Istio configuration and custom resources. To get a basic summary of clusters, listeners or routes for a given pod use the command as follows (changing clusters for listeners or routes when required):
$ istioctl proxy-config cluster -n istio-system istio-ingressgateway-7d6874b48f-qxhn5
SERVICE FQDN PORT SUBSET DIRECTION TYPE
BlackHoleCluster - - - STATIC
agent - - - STATIC
details.default.svc.cluster.local 9080 - outbound EDS
istio-ingressgateway.istio-system.svc.cluster.local 80 - outbound EDS
istio-ingressgateway.istio-system.svc.cluster.local 443 - outbound EDS
istio-ingressgateway.istio-system.svc.cluster.local 15021 - outbound EDS
istio-ingressgateway.istio-system.svc.cluster.local 15443 - outbound EDS
istiod.istio-system.svc.cluster.local 443 - outbound EDS
istiod.istio-system.svc.cluster.local 853 - outbound EDS
istiod.istio-system.svc.cluster.local 15010 - outbound EDS
istiod.istio-system.svc.cluster.local 15012 - outbound EDS
istiod.istio-system.svc.cluster.local 15014 - outbound EDS
kube-dns.kube-system.svc.cluster.local 53 - outbound EDS
kube-dns.kube-system.svc.cluster.local 9153 - outbound EDS
kubernetes.default.svc.cluster.local 443 - outbound EDS
...
productpage.default.svc.cluster.local 9080 - outbound EDS
prometheus.istio-system.svc.cluster.local 9090 - outbound EDS
prometheus_stats - - - STATIC
ratings.default.svc.cluster.local 9080 - outbound EDS
reviews.default.svc.cluster.local 9080 - outbound EDS
sds-grpc - - - STATIC
xds-grpc - - - STRICT_DNS
zipkin - - - STRICT_DNS
In order to debug Envoy you need to understand Envoy clusters/listeners/routes/endpoints and how they all interact. We will use the proxy-config
command with the -o json
and filtering flags to follow Envoy as it determines where to send a request from the productpage
pod to the reviews
pod at reviews:9080
.
If you query the listener summary on a pod you will notice Istio generates the following listeners:
- A listener on
0.0.0.0:15006
that receives all inbound traffic to the pod and a listener on0.0.0.0:15001
that receives all outbound traffic to the pod, then hands the request over to a virtual listener. - A virtual listener per service IP, per each non-HTTP for outbound TCP/HTTPS traffic.
- A virtual listener on the pod IP for each exposed port for inbound traffic.
- A virtual listener on
0.0.0.0
per each HTTP port for outbound HTTP traffic.
$ istioctl proxy-config listeners productpage-v1-6c886ff494-7vxhs
ADDRESS PORT TYPE
10.96.0.10 53 TCP <--+
10.109.221.105 15012 TCP |
10.96.121.204 15443 TCP | Receives outbound non-HTTP traffic for relevant IP:PORT pair from listener `0.0.0.0_15001`
10.96.0.1 443 TCP |
10.109.221.105 443 TCP |
10.96.121.204 443 TCP <--+
0.0.0.0 9090 HTTP+TCP <--+
10.96.0.10 9153 HTTP+TCP |
0.0.0.0 15010 HTTP+TCP |
0.0.0.0 80 HTTP+TCP | Receives outbound HTTP+TCP traffic for relevant port from listener `0.0.0.0_15001`
0.0.0.0 15014 HTTP+TCP |
10.109.221.105 853 HTTP+TCP |
10.96.121.204 15021 HTTP+TCP <--+
0.0.0.0 9080 HTTP+TCP // Receives all inbound traffic on 9080 from listener `0.0.0.0_15006`
0.0.0.0 15001 TCP // Receives all outbound traffic to the pod from IP tables and hands over to virtual listener
0.0.0.0 15006 HTTP+TCP
0.0.0.0 15090 HTTP
0.0.0.0 15021 HTTP
- A listener on
From the above summary you can see that every sidecar has a listener bound to
0.0.0.0:15006
which is where IP tables routes all inbound pod traffic to and a listener bound to0.0.0.0:15001
which is where IP tables routes all outbound pod traffic to. This listener hasuseOriginalDst
set to true which means it hands the request over to the listener that best matches the original destination of the request. If it can’t find any matching virtual listeners it sends the request to thePassthroughCluster
which connects to the destination directly.$ istioctl proxy-config listeners productpage-v1-6c886ff494-7vxhs --port 15001 -o json
[
{
"name": "virtualOutbound",
"address": {
"socketAddress": {
"address": "0.0.0.0",
"portValue": 15001
}
},
"filterChains": [
{
"filters": [
{
"name": "istio.stats",
"typedConfig": {
"@type": "type.googleapis.com/udpa.type.v1.TypedStruct",
"typeUrl": "type.googleapis.com/envoy.extensions.filters.network.wasm.v3.Wasm",
"value": {
"config": {
"configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n",
"root_id": "stats_outbound",
"vm_config": {
"code": {
"local": {
"inline_string": "envoy.wasm.stats"
}
},
"runtime": "envoy.wasm.runtime.null",
"vm_id": "tcp_stats_outbound"
}
}
}
}
},
{
"name": "envoy.tcp_proxy",
"typedConfig": {
"@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy",
"statPrefix": "PassthroughCluster",
"cluster": "PassthroughCluster"
}
}
],
"name": "virtualOutbound-catchall-tcp"
}
],
"useOriginalDst": true,
"trafficDirection": "OUTBOUND"
}
]
Our request is an outbound HTTP request to port
9080
this means it gets handed off to the0.0.0.0:9080
virtual listener. This listener then looks up the route configuration in its configured RDS. In this case it will be looking up route9080
in RDS configured by Istiod (via ADS).$ istioctl proxy-config listeners productpage-v1-6c886ff494-7vxhs -o json --address 0.0.0.0 --port 9080
...
"rds": {
"configSource": {
"ads": {}
},
"routeConfigName": "9080"
}
...
The
9080
route configuration only has a virtual host for each service. Our request is heading to the reviews service so Envoy will select the virtual host to which our request matches a domain. Once matched on domain Envoy looks for the first route that matches the request. In this case we don’t have any advanced routing so there is only one route that matches on everything. This route tells Envoy to send the request to theoutbound|9080||reviews.default.svc.cluster.local
cluster.$ istioctl proxy-config routes productpage-v1-6c886ff494-7vxhs --name 9080 -o json
[
{
"name": "9080",
"virtualHosts": [
{
"name": "reviews.default.svc.cluster.local:9080",
"domains": [
"reviews.default.svc.cluster.local",
"reviews.default.svc.cluster.local:9080",
"reviews",
"reviews:9080",
"reviews.default.svc.cluster",
"reviews.default.svc.cluster:9080",
"reviews.default.svc",
"reviews.default.svc:9080",
"reviews.default",
"reviews.default:9080",
"10.98.88.0",
"10.98.88.0:9080"
],
"routes": [
{
"name": "default",
"match": {
"prefix": "/"
},
"route": {
"cluster": "outbound|9080||reviews.default.svc.cluster.local",
"timeout": "0s",
}
}
]
...
This cluster is configured to retrieve the associated endpoints from Istiod (via ADS). So Envoy will then use the
serviceName
field as a key to look up the list of Endpoints and proxy the request to one of them.$ istioctl proxy-config cluster productpage-v1-6c886ff494-7vxhs --fqdn reviews.default.svc.cluster.local -o json
[
{
"name": "outbound|9080||reviews.default.svc.cluster.local",
"type": "EDS",
"edsClusterConfig": {
"edsConfig": {
"ads": {}
},
"serviceName": "outbound|9080||reviews.default.svc.cluster.local"
},
"connectTimeout": "10s",
"circuitBreakers": {
"thresholds": [
{
"maxConnections": 4294967295,
"maxPendingRequests": 4294967295,
"maxRequests": 4294967295,
"maxRetries": 4294967295
}
]
},
}
]
To see the endpoints currently available for this cluster use the
proxy-config
endpoints command.$ istioctl proxy-config endpoints productpage-v1-6c886ff494-7vxhs --cluster "outbound|9080||reviews.default.svc.cluster.local"
ENDPOINT STATUS OUTLIER CHECK CLUSTER
172.17.0.7:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local
172.17.0.8:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local
172.17.0.9:9080 HEALTHY OK outbound|9080||reviews.default.svc.cluster.local
Inspecting bootstrap configuration
So far we have looked at configuration retrieved (mostly) from Istiod, however Envoy requires some bootstrap configuration that includes information like where Istiod can be found. To view this use the following command:
$ istioctl proxy-config bootstrap -n istio-system istio-ingressgateway-7d6874b48f-qxhn5
{
"bootstrap": {
"node": {
"id": "router~172.30.86.14~istio-ingressgateway-7d6874b48f-qxhn5.istio-system~istio-system.svc.cluster.local",
"cluster": "istio-ingressgateway",
"metadata": {
"POD_NAME": "istio-ingressgateway-7d6874b48f-qxhn5",
"istio": "sidecar"
},
"buildVersion": "0/1.8.0-dev//RELEASE"
},
...
Verifying connectivity to Istiod
Verifying connectivity to Istiod is a useful troubleshooting step. Every proxy container in the service mesh should be able to communicate with Istiod. This can be accomplished in a few simple steps:
Create a
sleep
pod:$ kubectl create namespace foo
$ kubectl apply -f <(istioctl kube-inject -f samples/sleep/sleep.yaml) -n foo
Test connectivity to Istiod using
curl
. The following example invokes the v1 registration API using default Istiod configuration parameters and mutual TLS enabled:$ kubectl exec $(kubectl get pod -l app=sleep -n foo -o jsonpath={.items..metadata.name}) -c sleep -n foo -- curl -sS istiod.istio-system:15014/debug/endpointz
You should receive a response listing the “service” and “endpoint” for each service in the mesh.
What Envoy version is Istio using?
To find out the Envoy version used in deployment, you can exec
into the container and query the server_info
endpoint:
$ kubectl exec -it prometheus-68b46fc8bb-dc965 -c istio-proxy -n istio-system pilot-agent request GET server_info
{
"version": "12cfbda324320f99e0e39d7c393109fcd824591f/1.14.1/Clean/RELEASE/BoringSSL"
}
See also
Install Istio with the Istio CNI plugin
Install and use Istio with the Istio CNI plugin, allowing operators to deploy services with lower privilege.
Mixer Configuration Model (Deprecated)
Describes the configuration model for Istio’s policy enforcement and telemetry mechanisms.
Describes the telemetry and monitoring features provided by Istio.
Describes the various Istio features focused on traffic routing and control.