1

TL;DR: How to fall back to the external service after n reties on cluster pods?

There is VirtualService that routes HTTP requests to the cluster pods and retries if pods return 503. I need requests to be routed to the external service after the n retries.

Is it possible to use x-envoy-attempt-count header field inside VirtualService routing?

http:
  - match:
    - headers:
        x-envoy-attempt-count:
          exact: 5

Are there any other options?

Istio 1.9.4 It seems like during retry routes are not reevaluated so the route with the header match never gets selected.

Jonas
  • 4,683
  • 4
  • 45
  • 81
  • I need something like Nginx `backup` directive for the upstream http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream – Jonas May 19 '21 at 07:54

1 Answers1

0

bad news...Unless smth changed currently this is not possible with Istio. There had already been reply on this topic - maybe you missed it.

Please check Configure istio destination rule to use a fallback URL instead of 503

With a service mesh, at the moment without specialized libraries for failure context propagation, the failure reasons are more opaque. This doesn’t mean our application cannot take fallbacks (for both transport and client-specific errors). I’d argue it’s very important for the protocol of any application, whether using library-specific frameworks OR NOT) to always adhere to the promises it’s trying to keep for its clients. If it finds that it cannot complete its intended action, it should figure a way to gracefully degrade. Luckily, you don’t need application-specific frameworks for this. Most languages have built-in error and exception trapping and handling. Fallbacks should be implemented in these exception paths.

Vit
  • 7,740
  • 15
  • 40