Add a custom header per rule on Kubernetes Ingress with Istio

2/11/2022

I have created a Kubernetes ingress on my cluster where it uses Istio as an ingress controller. I don't want to use the gateway and virtual service provided by Istio and would like to set this up with the good old Kubernetes ingress.

What I am having a hard time with is configuring a custom header to this ingress. I know with:

  • Nginx ingress controller, I can use nginx.ingress.kubernetes.io/configuration-snippet: 'more_set_input_headers "foo: bar";'
  • Traefik, I can use ingress.kubernetes.io/custom-request-headers: "foo: bar"

What is the corresponding annotation while using Istio? or is that even possible while using Istio this way?

-- riyasyash
istio
kubernetes
kubernetes-ingress
request-headers

1 Answer

2/11/2022

Not really possible. To add a custom header to the request, you have to add

headers:
  request:
    add:
      custom-header: value

block to a VirtualService.

There are no Resource Annotations in Istio that control this behaviour, like with nginx or Traefik.

-- p10l
Source: StackOverflow