
요약
I’m Hun, a member of the cluster group within Karrot’s Site Reliability Engineering (SRE) team. We design and operate the Kubernetes environment that runs Karrot’s internal services. We build the monitoring systems that let us see what happens inside our clusters, set policies for service communication and security, and carry improvements through to production.
When a team releases a new version of an API, callers keep sending requests to the same address. The pods behind that address change. Kubernetes adds newly ready pods to the Service’s list of destinations and removes pods that are shutting down.
At Karrot, we use Istio to get that updated list to callers. Istio is a service mesh that manages how requests move between services and how their connections are secured. In our environment, the list goes to Envoy, a proxy running in the same pod as the calling application. Envoy selects a pod from the list and forwards the request.
During one rollout, some requests to the same API returned HTTP 503 while others succeeded. Had Envoy picked a pod that had already shut down?
We started with the shutdown logs from the pods serving the API. Then we looked at metrics from istiod, the Istio control plane that sends updated pod addresses to callers. At the time of the incident, istiod had a backlog of configuration updates.
Two sources of work stood out. The first was a sidecar controller we had built so that each pod’s istio-proxy would receive configuration only for the services it needed to reach. The controller was triggering unnecessary pushes as it updated that configuration. The second was a set of Kubernetes Services we used to discover pods for metrics collection.
To understand what was delaying the address updates, we followed both kinds of push through istiod and measured what changed when we eliminated the unnecessary work.
1. Two spikes in 503s, both as pods shut down
Our first indication was an alert about an increase in 5xx errors. By the time it fired, the rollout was over. Several services had received 503s, but every failed request had been bound for the API we had just deployed. Looking back to the start of the rollout, we could see two spikes. The first coincided with the new pods coming up and the old pods shutting down. The second triggered the alert.
Why would there be a second spike after the rollout had finished? Kubernetes events showed that two pods serving the API had been evicted from the same node. Karpenter, which manages our cluster nodes, had drained that node and evicted its workloads.

In both windows, the caller’s Envoy recorded UF (upstream connection failure) and URX (retry limit exceeded). As pods serving the API shut down, callers were failing to connect to an upstream. The metric didn’t identify which pod Envoy had tried to reach. We needed to understand how it picked a destination.
How does the caller’s Envoy learn that a pod address has changed?
Suppose three pods, A, B, and C, serve the same API. Envoy runs in a sidecar container named istio-proxy in the calling application’s pod. When the application sends a request to the API’s service name, Envoy selects A, B, or C from its local list and opens a connection.

istiod supplies that list. Kubernetes records the addresses and readiness of a Service’s pods in EndpointSlice resources, which istiod watches for changes.
Envoy connects to istiod through the Istio agent in the same sidecar and subscribes to the configuration it needs. xDS is the family of APIs they use to exchange that configuration. One member of that family, the Endpoint Discovery Service (EDS), delivers the destination addresses. Each available destination in the list is an endpoint.

When B goes away, two things happen independently. The application on B begins shutting down. Meanwhile, istiod sees the change to the EndpointSlice and sends a new list without B. If the application stops accepting connections before the caller’s Envoy receives that list, requests sent to A or C can still succeed while a connection to B can fail.

The logs for one evicted pod gave us a shutdown time. The application container’s preStop hook waited five seconds. The application exited about six to seven seconds after pod termination began.
How quickly was istiod sending configuration at the time? We looked at pilot_proxy_convergence_time, the Istio metric for per-proxy configuration send time. It measures the time in seconds from when istiod starts queuing the push to when it finishes its send-side processing for that proxy. Across the cluster, the 99th percentile (p99) was about 10 seconds during the rollout and about 9 seconds during the node drain.

The six to seven seconds came from one pod’s shutdown log. The nine seconds came from the cluster-wide p99 during the same period. The metric’s pod label identifies the istiod pod that recorded the duration. It doesn’t identify the receiving Envoy or the endpoint list it received.
To establish whether a failed request went to a pod that had already exited, we would have needed the destination IP and the time of the connection attempt to compare with that pod’s shutdown log. To establish that the address update was late, we would also have needed the time the caller’s Envoy applied the list without that IP. Our logs did not record the destination IP of the failed connection.
2. Why was istiod taking so long to send configuration?
Before deciding whether to extend the preStop delay, we checked how long configuration updates took when deployments were quiet.
Even in a window with no notable rollouts, the median send time (p50) was about 0.6 seconds and p99 was about 4.5 seconds. Some updates routinely took several seconds. The istiod logs for that window repeatedly showed full=true.
What does istiod recalculate when an address changes?
When a sidecar starts, Envoy subscribes to the configuration it needs. The sidecar’s Istio agent maintains a bidirectional gRPC stream to istiod. When addresses or routing rules change, istiod sends updates over that same stream. Envoy returns an ACK when it accepts an update or a NACK with a reason when it rejects one. istiod records send time as soon as its own send-side processing finishes, before it receives that acknowledgment.
The simplest case is an incremental EDS update. Suppose B’s address is removed from a regular Service and all its traffic rules stay the same. istiod already has a PushContext, its prepared view of services and traffic configuration. It can reuse that context (full=false) and send the endpoint list without B to the Envoys subscribed to that Service.
A change to the set of services visible to a workload triggers a full push (full=true). istiod prepares a new PushContext reflecting the change, then evaluates each connected proxy to determine what it needs. Even when only a few proxies ultimately receive new configuration, istiod still has to identify them.
Each proxy receives the configuration relevant to it. CDS describes a cluster, a group of upstream destinations. EDS provides the addresses of the endpoints Envoy can connect to within that cluster. LDS provides the listeners that tell Envoy how to handle incoming connections. For an HTTP request, Envoy uses the routes supplied by RDS to select an upstream cluster.
An EDS-only update that removes a terminated pod uses the same queue as a full push. Pending changes for the same proxy can merge into one work item. When other configuration changes fill the queue, the new address list that callers need during a rollout can end up waiting behind them.
There’s a detail worth knowing when reading a full=true log entry. Suppose an Envoy subscribes to the endpoints for Search and Chat. If only Search needs a new endpoint list, the EDS response contains just the Search list, even during a full push. The EDS code in Istio 1.28.2, the version we ran, calls this a partial full push. The log still records full=true. istiod evaluates other resource types, such as listeners, separately.

The Envoy in this example receives one address list. On the istiod side, that same change can create work for many proxies. Was the backlog in production a result of frequent changes, or did each change put more work on the queue? We compared production with our alpha environment, where we validate changes before deployment.
How many times does one change count?
We started with pilot_push_triggers, which records what triggered a push. Its type label includes config for configuration changes, service for Service changes, and endpoint for endpoint changes. At first, we read an increase of 20 in config as 20 separate configuration changes.
Reading the code showed how a single change could produce that number. Suppose one configuration change creates one work item for each of 20 proxies. As istiod takes each item off the queue, it records what triggered it. In this case it adds one to config, then checks whether it has anything new to send to that proxy. After all 20 items have been processed, config has increased by 20, even if only one proxy received new configuration.
To measure how often changes actually arrived, we counted the events istiod received from Kubernetes. We used pilot_k8s_cfg_events for additions, updates, and deletions of Istio resources such as Sidecar. For events on resources used to discover service destinations, including pods and EndpointSlice objects, we used pilot_k8s_reg_events.
On the sending side, we measured the average number of sends to proxies per batch of changes. istiod batches changes that arrive close together. Since multiple istiod instances in production each receive the same events, we compared the two environments on a per-instance basis.

Each istiod instance had 874 connected proxies in the alpha environment and 1,025 in production. Configuration change events were more frequent in the alpha environment, and each instance processed about 1.3 batches per second in both environments. Yet each batch produced an average of 19 sends to proxies in the alpha environment and 157 in production.
Which changes were generating all those sends? We grouped the production full=true log entries by resource name and looked at when each name appeared. Some recurred every five minutes. Others appeared whenever pods were replaced.
3. Our controller was rewriting the same host list every five minutes
The recurring entries named Sidecar resources across several namespaces. An Istio Sidecar determines which services a workload’s Envoy receives configuration for. This example applies to the checkout application in the shop namespace.
apiVersion: networking.istio.io/v1
kind: Sidecar
metadata:
name: checkout
namespace: shop
spec:
workloadSelector:
labels:
app: checkout
egress:
- hosts:
- "./*"
- "shared/*"
In egress.hosts, ./* includes services in checkout’s own namespace, shop. The entry shared/* includes services exported by the shared namespace.
We had built a sidecar controller to populate this list so that each workload’s Envoy would keep only the configuration it needed. Every five minutes, the controller reads Istio traffic metrics and updates egress.hosts based on the services each workload actually called.
We initially thought workloads had started calling additional services. When we lined up the controller and istiod logs, we saw a full=true entry for the same resource immediately after each five-minute write. But when we compared egress.hosts before and after the write, both lists contained exactly the same hosts.
What happens when the same hosts are saved in a different order?
The controller used a Go map to remove duplicates when merging the existing hosts with the default hosts. Go doesn’t guarantee iteration order for a map. Rebuilding the list could therefore change the order without adding or removing a single host.
- hosts: ["./*", "team-a/*", "team-b/*"]
+ hosts: ["team-b/*", "./*", "team-a/*"]
Both lists expose the same services to Envoy. All that changed was that team-b/* moved from the end to the beginning. When istiod compares the old and new Sidecar specifications, however, array order matters. In one production reconciliation cycle, the controller rewrote the host lists of 194 Sidecar resources. Wherever the order changed, istiod treated the write as a configuration change and initiated a full push.
We updated the controller’s reconciliation logic to remove duplicates and skip the write when only the order differed. We deployed the updated controller to the alpha environment first and checked pilot_push_triggers again.

The green line shows config triggers across the alpha environment. Before the rollout, istiod recorded a configuration change as the reason for a per-proxy work item 1,900–2,400 times per second. Afterward, the rate fell to a few dozen per second. Because this metric includes other configuration changes, we also counted full pushes attributable to Sidecar changes in the istiod logs. On a single istiod instance, they fell from about 3,000 per hour to 20.
Another trigger remained in the same alpha environment. headlessendpoint records pushes triggered by a change to the pod addresses behind a headless Service. One Service that Prometheus used to discover application pods for scraping still appeared in the full=true logs about three times per hour.
4. Why does replacing one pod behind a headless Service trigger a full push?
Return to pod B. Suppose it shuts down and pod D takes its place, listening on the same port, 8080. With a regular ClusterIP Service, the Service’s virtual IP stays the same. The calling application still sends requests to the same IP and port. What changes is the list of pods its Envoy can connect to.

A headless Service is created with clusterIP: None. A DNS lookup for its service name returns pod IPs directly. When D replaces B, the same name resolves to a different set of addresses.
One headless Service that appeared frequently in the production logs helped Prometheus discover scrape targets. Prometheus fetched the metrics over HTTP, but the Service port was named metrics and its appProtocol was unset. Istio 1.28.2 did not classify that port as HTTP-only. When a pod address changed, istiod followed the same update path it would for a Service with a plain TCP port.
For TCP, the pod IP also appears in the listener configuration
When Istio handles the port as plain TCP, the caller’s Envoy uses the destination IP and port to determine which service a connection is for. A listener tells Envoy which connections to match and how to handle them. The listener matching traffic to B includes B:8080.
D uses port 8080 as well, but D:8080 is a new destination for Envoy to recognize. Updating the endpoint list through EDS replaces B with D there. It leaves the listener unchanged. To apply the Service’s rules to connections bound for D, Envoy also needs a listener that matches D:8080. The Listener Discovery Service (LDS) delivers that configuration.
In the Istio 1.28.2 code, an endpoint change for this type of TCP headless Service requests both an EDS update and a full push with the reason HeadlessEndpointUpdate. istiod batches incoming changes, prepares a new PushContext, and queues work for each connected proxy. It sends updated listeners to the proxies that need to recognize D’s IP.
Replacing one pod was enough to make istiod reconsider configuration for multiple proxies. During a rollout, the update that removed a terminated pod’s address had to wait in that same queue.

What if we had explicitly marked the port as HTTP-only?
Now suppose port 8080 on the same Service is explicitly marked as HTTP. Envoy can distinguish requests on that port by their Host header. The existing HTTP listener can handle requests after D replaces B.
What does change is the set of addresses returned by DNS. With DNS capture enabled, the sidecar’s istio-agent receives the application’s DNS lookup first. If it has an entry for the name in its local table, it returns the IPs. Otherwise, it forwards the query to the usual DNS server. istiod sends service names and IP addresses to the agent through the Name Discovery Service (NDS).
We run our sidecars with DNS capture disabled. Applications query their usual DNS server, and istio-agent does not request a DNS table from istiod. So why would an HTTP-only Service still trigger a full push?
In Istio 1.28.2, the first decision happens when istiod sees a pod address change in an EndpointSlice. For an HTTP-only headless Service visible to the mesh, istiod marks the changed resource as DNSName and requests a full push. The ordinary incremental push path in this version does not update the NDS name table.
istiod refreshes its view of services and endpoints, recalculates which services each Sidecar configuration can see, and queues work for the connected proxies. Only when istiod takes a proxy’s work item off the queue does it check whether that proxy subscribes to the DNS table. Our sidecars do not subscribe to NDS, so istiod sends them no DNS table.
Marking every mesh-visible metrics port as HTTP would therefore still have left us with full push requests when pod addresses changed. By the time istiod knew there was no DNS table to send, it had already done the calculations and queued the work.

Which Services kept appearing in the production logs?
The headlessendpoint metric label gives us the reason for a push. The production full=true logs also identify the resource that changed. For the TCP example above, a pod address change appears in those logs as a ServiceEntry.
A ServiceEntry appeared in 47% of sampled production full push log entries during a rollout and 57% during a quiet period. Changes to ordinary Kubernetes Services can appear under the same resource kind, and several changes can be batched into one push. We matched the names in the logs to individual Kubernetes Services. The headless Services that appeared most often during the rollout were all used for metrics collection.
In a separate quiet window, the application metrics Service alone appeared in about 22% of the full=true entries. At the time, about 3,800 Envoy proxies were eligible to receive configuration for it. Fifty were Istio ingress gateway proxies. The rest were application sidecars.

Does Envoy need the addresses Prometheus scrapes?
Prometheus ran outside the mesh. It used Kubernetes EndpointSlice resources to find the pod and port from which to collect each set of metrics. That periodic collection is called scraping. When D came online, Prometheus could discover it directly through the EndpointSlice. The caller’s Envoy listener was never part of that path.
Other workloads rely on headless Services for peer discovery, so we checked how each Service was used. We selected Services used exclusively for Prometheus scraping that had also seen no mesh traffic in the previous 30 days. The change was a single annotation on the Kubernetes Service.
metadata:
annotations:
networking.istio.io/exportTo: "~"
exportTo controls which namespaces can see a Service through their proxies. We set it to ~ so that none of the proxies in the mesh would receive configuration for these scrape-only Services.
When a new pod starts, Kubernetes still adds its address to the EndpointSlice, and Prometheus discovers and scrapes it as before. istiod sees the same change and updates its endpoint cache. With exportTo set to ~, processing stops there. This address change triggers neither an EDS update nor a full push.

We applied the annotation in the alpha environment first. In the window we checked afterward, the annotated Services triggered zero full pushes. Scraping continued. For node-exporter, which exposes node metrics, Prometheus reported up = 1 for all 115 targets.

5. How much did send time and CPU usage fall in production?
In production, we deployed the sidecar controller first. We then annotated the scrape-only headless Services in two stages, starting with the Services for workloads that run on every node and following with those for application pods. After each change, we checked how often the affected resource names appeared in istiod’s full push logs.

Full pushes that named a Sidecar (blue) fell first, after the controller rollout. Pushes that named a ServiceEntry (red) still showed several large spikes. As we removed the scrape-only Services from the configuration visible to mesh proxies, the red series fell as well.
We compared the two and a half hours immediately after the final change with the same time window the previous day. Before the change, istiod recorded headlessendpoint 2,370 times per second as it took per-proxy work items off the queue. In the first two and a half hours after the change, we saw no such triggers. Over a longer post-change window of 17.5 hours, the average was 1.2 per second. We used the original two-and-a-half-hour windows to compare send time and CPU usage.

On one istiod instance, the number of full pushes fell from 8,630 to 78. The share of per-proxy work items that spent more than 100 ms in the queue fell from 24.2% to 0.48%.
Including time spent in the queue, mean per-proxy configuration send time fell from 1,051 ms to 10 ms. The share of sends taking more than one second fell from 40.4% to 0.065%.
We also added up CPU usage across all 12 istiod pods. Average combined usage fell from 82 cores to 5.4 cores over those same two windows.
Were there simply fewer deployments after the change?
The same time of day can bring a series of large rollouts one day and a handful of small ones the next. We repeated the comparison using five-minute windows in which Service changes triggered per-proxy work at similar rates.
We used the service series of pilot_push_triggers. A single rollout can produce a larger value when more proxies are involved. We took a longer stretch of production data on either side of the change, split it into five-minute windows, and kept those with 300–700 service triggers per second. That gave us 22 windows before the change and 10 after.
We calculated the mean send time for each window and averaged those means. It fell from 1,227 ms to 17 ms. The average share of sends taking more than one second per window also fell, from 47.9% to 0.21%.
How often did an update still take more than five seconds?
Returning to the two and a half hours after the final production change and the same period the previous day, xDS sends taking more than five seconds fell from about 7,400 per million to about 3 per million. After the change, more than 99% of sends finished within 100 ms.

Did the same 503s appear in later deployments?
During the original incident, the caller’s Envoy recorded both an upstream connection failure (UF) and an exceeded retry limit (URX). We deployed the same API several more times after the changes. Across those deployments, we saw no further 503s with both flags in the caller-side Envoy metrics.
Closing thoughts
When we first saw the 503s, we wondered whether extending the preStop delay by a few seconds would help. But even when deployments were quiet, some configuration updates took several seconds to send. In the istiod logs, the same Sidecar names appeared every five minutes, and the names of Services used for metrics collection kept appearing in between. The host lists were correct and metrics were coming in, so we hadn’t expected istiod to recalculate proxy configuration so often.
When we traced how istiod handles xDS pushes, we found that it queued work for multiple proxies even when a host list was simply reordered or a pod behind a metrics collection Service was replaced. The endpoint updates that removed the addresses of pods shutting down during a rollout went through the same queue. That prompted us to look at what the proxies actually needed. The reordered list still pointed to the same services, and Prometheus could discover new scrape targets directly through Kubernetes. After we reduced pushes from both sources, the average time istiod took to send configuration to a proxy in production, including time spent in the queue, fell from 1,051 ms to 10 ms.
If you’ve investigated similar errors during a rollout, I hope our experience gives you another place to look. Thank you for reading.
From Deployment-Time 503s to Faster Istio xDS Updates was originally published in 당근 기술 블로그 on Medium, where people are continuing the conversation by highlighting and responding to this story.