Skip to main content
In this lesson you’ll configure an Istio circuit breaker by deploying a simple echo application, a Fortio load tester, and then applying a VirtualService + DestinationRule that implements connection pool limits and outlier detection. You will generate load to observe how Envoy enforces the circuit breaker and learn how to inspect the sidecar proxy stats. Key terms: Istio circuit breaker, DestinationRule, connectionPool, outlierDetection, Envoy, Fortio.

1. Verify the namespace is Istio-injection enabled

Confirm your target namespace has the istio-injection=enabled label. If it is not labeled, add the label and re-deploy your workloads so sidecars are injected. Example to check labels:
If needed, label your namespace:

2. Deploy the Echo server and Service

Create a Deployment (e.g., echo_deployment.yaml) for a simple HTTP echo server that listens on port 80, and expose it via a ClusterIP Service echo-server. Service manifest (echo_svc.yaml):
Apply the manifests and confirm pods and service are ready:

3. Deploy Fortio (load tester)

Fortio is a lightweight load tester you can run inside the cluster to generate requests to the echo service. Deploy Fortio and confirm the pod is running:
Verify connectivity by curling the echo service from the Fortio container:
Tip: replace the Fortio pod name if it differs in your cluster.

4. Create a VirtualService (simple passthrough)

Create a VirtualService that intercepts traffic for echo-server and routes to the same Kubernetes Service. This keeps routing explicit and prepares the path for upstream policies. vs.yaml:
Apply and verify:
The VirtualService itself does not change behavior yet — it simply ensures traffic is routed through Istio.

5. Create a DestinationRule to implement circuit breaking

Circuit breaking in Istio is enforced by DestinationRule through connectionPool limits and outlierDetection. Create a DestinationRule to limit connections and eject unhealthy hosts. dr.yaml:
Meaning of key fields:
  • connectionPool.tcp.maxConnections: 1 — only 1 concurrent TCP connection to the upstream.
  • http.http1MaxPendingRequests: 1 & maxRequestsPerConnection: 1 — limited pending and per-connection requests.
  • outlierDetection.consecutive5xxErrors: 1 — a single 5xx can mark a host for ejection.
  • interval, baseEjectionTime, maxEjectionPercent — control detection frequency and ejection behavior.
Apply the DestinationRule and verify:

6. Generate load to trigger the circuit breaker

Start with a simple request from Fortio to confirm correct routing:
Run a modest load test (2 concurrent connections, 20 requests):
Sample summary (abbreviated):
Now increase concurrency to force Envoy to hit the configured connection/pending limits:
When the circuit breaker is engaged you will see many 503 responses:
Explanation: Envoy enforces maxConnections and pending request limits; when those are exceeded, it rejects requests with 503.

7. Adjust DestinationRule and observe effect

To allow more concurrent traffic, increase connection and request-per-connection limits in the DestinationRule, reapply, and re-run the load test. Example changes inside dr.yaml:
Apply and test:
You should see fewer 503s as the proxy allows more concurrent connections/requests. Tune the values to match your upstream application’s concurrency characteristics.
When setting connection pools and circuit breakers, align limits with your application’s real concurrency and connection behavior. Overly strict limits can cause apparent outages under legitimate load.

8. Inspect Envoy proxy stats (pilot-agent)

To view circuit breaker metrics exposed by the sidecar, query the pilot-agent stats endpoint from the pod’s istio-proxy container. These stats show pending totals and overflow/rejection counters that explain observed 503s. Example command (filtering for echo-server and pending counters):
Example fields you might see:
  • upstream_rq_pending_total — total pending requests.
  • upstream_rq_pending_overflow — number of requests rejected due to pending limits.
Circuit breaking and aggressive rate-limiting can be disruptive. Do not apply global or overly strict DestinationRule policies in production without monitoring, staging, and understanding application behavior.

9. DestinationRule options and examples

DestinationRule includes several useful configuration groups for connection management and resilience. More complete examples:
TCP keepalive example:
The image shows a webpage from Istio's documentation, specifically detailing configuration options for networking such as maxRequestsPerConnection and idleTimeout. It includes sections on HTTP/2 upgrade policy and connection settings.

10. Summary

  • Istio circuit breaking is configured via DestinationRule using connectionPool (limits) and outlierDetection (host ejection).
  • VirtualService routes traffic; DestinationRule enforces proxy behavior on the destination.
  • Use Fortio (or similar tools) to generate load and verify how Envoy responds when limits are reached (often 503).
  • Inspect sidecar stats (pilot-agent / stats endpoint) to diagnose pending/overflow counters.
  • Always test and tune connection-pool and outlier settings to match your application’s concurrency model before applying policies in production.
Links and references: For exam preparation: when you hear “circuit breaking” in Istio, think “DestinationRule” and be familiar with connectionPool and outlierDetection settings.

Watch Video

Practice Lab