Dynamic header based routing with fallback Dynamic header based routing with fallback kubernetes kubernetes

Dynamic header based routing with fallback


You can do that using Istio VirtualService

apiVersion: networking.istio.io/v1beta1kind: VirtualService...spec:  hosts:  - reviews  http:  - match:    - headers:        end-user:          exact: jason    route:    - destination:        host: reviews        subset: v2  - route:    - destination:        host: reviews        subset: v1

Read more here.


Yes you can rout the request based on a header with Istion & Linkerd

For istio there is nice article : https://dwdraju.medium.com/simplified-header-based-routing-with-istio-for-http-grpc-traffic-ff9be55f83ca

in istio's virtual service you can update the header like :

http:  - match:    - headers:        x-svc-env:          regex: v2

For linkerd :

Kind = "service-router"Name = "service"Routes = [  {    Match {      HTTP {        PathPrefix = "/api/service/com.example.com.PingService"      }    }    Destination {      Service       = "pinging"    },  },  {    Match {      HTTP {        PathPrefix = "/api/service/com.example.com.PingService"        Header = [          {            Name  = "x-version"            Exact = "2"          },        ]      }    }    Destination {      Service       = "pinging"      ServiceSubset = "v2"    },  }