In our Kubernetes cluster, we have a deployment and we are using a headless service to route the request internally as we need to send the request to the specific pod.
we are using an Istio virtual service and gateway combination to route the incoming request to the specific pod of incoming service. Here is a glimpse of the virtual service and gateway detail.
Note: we are using the TLS passthrough mode. And it is all working fine.
** New Requirement:**
I am looking to add a service url only if the specific pod is unavailable. so if the pod is unavailable, it should send the request to service rather than a specific pod. so as below, I have configured for pod0 so all p0.service.domain.com
requests will be going to pod-2.myservice.mynamespace
, but if pod0 is not available it should start sending the request to myservice.mynamespace
till the pod is not up again.
Current implementation: Kubernetes service name: myservice main domain: service.domain.com url to redirect to the specific pod: p{i}.service.domain.com, here p0.service.domain.com and it go on to any number of URLs.
Below is the virtual service details.
tls:
- match:
- port: 8080
sniHosts:
- p0.service.domain.com
route:
- destination:
host: pod-2.myservice.mynamespace
port:
number: 8080
weight: 100
Gateway:
- port:
number: 8080
name: https-8080
protocol: HTTPS
tls:
mode: PASSTHROUGH
hosts:
- "*.service.domain.com"
- "service.domain.com"
I tried adding the different combination of destination rule and virtualservice but it did not work.