Disable Istio default retry on errorcode 503

581 Views Asked by At

I am not sure, whether we are talking about the smae issue. I will try to explain the scenario which I am trying. I have 2 services appservice-A and appservice-B, both are in the same namespace "mynamespace" and both have seperate Virtual service called VS-A and VS-B.

In MyAPPLICATION, there is a call from appservice-A to appservice-B , and I want to disable the retry when the ServiceB throwing a 503 error, and the ServiceA should not retry again. So what I enabled is in the VS-B, I added the retry-attempt to 0, by expecting that appservice-A wont retry an attempt if the appservice-B throws a 503 error.. Which is not working for me.

I performed a testing again with the sample for you by making the attempt 0 in the VS-B. but still there is no change is happening to the retries, still showing 2.

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  labels:
    app.kubernetes.io/managed-by: Helm
  name: appservice-B
  namespace: mynamespace
spec:
  gateways:
  - istio-system/ingress-gateway
  hosts:
  - appservice-B.mynamespace.svc.cluster.local
  - appservice-B.mycompany.com
  http:
  - match:
    - uri:
        prefix: /
    retries:
      attempts: 0
    route:
    - destination:
        host: appservice-B.mynamespace.svc.cluster.local
        port:
          number: 8080
        subset: v1

this is the proxy config routing rule out put which generated from appservice-A

istioctl proxy-config route appservice-A-6dbb74bc88-dffb8 -n mynamespace -o json

                "routes": [
                    {
                        "name": "default",
                        "match": {
                            "prefix": "/"
                        },
                        "route": {
                            "cluster": "outbound|8080||appservice-B.mynamespace.svc.cluster.local",
                            "timeout": "0s",
                            "retryPolicy": {
                                "retryOn": "connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes",
                                "numRetries": 2,
                                "retryHostPredicate": [
                                    {
                                        "name": "envoy.retry_host_predicates.previous_hosts"
                                    }
                                ],
                                "hostSelectionRetryMaxAttempts": "5",
                                "retriableStatusCodes": [
                                    503
                                ]
                            },
                            "maxStreamDuration": {
                                "maxStreamDuration": "0s",
                                "grpcTimeoutHeaderMax": "0s"
                            }
                        },
                        "decorator": {
                            "operation": "appservice-B.mynamespace.svc.cluster.local:8080/*"
                        }
                    }
                ],
                "includeRequestAttemptCount": true

So, suspect that , whether I am trying right things for my scenario, If this also right, any workaround like Is there achange the property of status codes or headers from responses to disable, so that istio wont retry appservice-B from appservice-A if a 503 errorcode got from appservice-B ?

0

There are 0 best solutions below