Skip to main content

DestinationRule

A DestinationRule is an Istio resource that defines what happens to traffic after routing has chosen a destination. It groups pods into named subsets, such as v1 and v2, and sets load balancing, connection pool, outlier detection, and TLS policy for them.

DestinationRule and VirtualService

A VirtualService decides where requests go. A DestinationRule defines what those destinations are and how connections to them behave. Traffic splitting needs both.

flowchart TD V["VirtualService
routes 90 and 10"] -->|"subset v1"| S1["v1 pods
version=v1"] V -->|"subset v2"| S2["v2 pods
version=v2"] D["DestinationRule
defines subsets and policy"] -.->|"selects by label"| S1 D -.->|"selects by label"| S2 classDef rule fill:#8B5CF6,color:#ffffff classDef route fill:#FFEDD5,color:#1E293B classDef pod fill:#D1FAE5,color:#1E293B class D rule class V route class S1,S2 pod

Subsets and policy

YAML
apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
name: orders-service
namespace: production
spec:
host: orders-service
trafficPolicy: # applies to all subsets
loadBalancer:
simple: LEAST_REQUEST
connectionPool:
http:
http1MaxPendingRequests: 100
outlierDetection:
consecutive5xxErrors: 5
interval: 10s
baseEjectionTime: 30s
subsets:
- name: v1
labels:
version: "v1"
- name: v2
labels:
version: "v2"
trafficPolicy: # override for v2 only
outlierDetection:
consecutive5xxErrors: 3
baseEjectionTime: 60s

Common load balancer modes: ROUND_ROBIN, LEAST_REQUEST, RANDOM, and PASSTHROUGH. Client-side TLS is set with tls.mode: ISTIO_MUTUAL.

Bash
istioctl analyze -n production
Remember

Subsets select pods by label. The label must exist on the pod template, not just on the Deployment.

Tip

Apply the DestinationRule before the VirtualService that references its subsets.

Common Mistake

Referencing a subset in a VirtualService that no DestinationRule defines. Istio returns 503 errors for that route.

Frequently Asked Questions

Do I need both a VirtualService and a DestinationRule?

For subset-based routing, yes. The VirtualService picks a subset, and the DestinationRule defines the subset by labels and sets the connection policy.

Why do I get 503 errors after adding a canary route?

Usually the VirtualService references a subset that is missing or mislabeled in the DestinationRule. Run istioctl analyze, which flags this directly.

Where does circuit breaking live?

In the DestinationRule trafficPolicy, through connectionPool limits and outlierDetection.

Found a mistake, an outdated step or a broken link?