1
votes

I'm trying to specify VirtualService with route to specific pod IP. For instance, in case my pod IP is 192.168.208.75 then I setting "host" as:

host: 192-168-208-75.default.pod.cluster.local

This doesn't works.

However, in case I have some Service pointing to that pod, routing traffic to service DNS name does works.

Is it possible to specify route to specific pod IP directly, without service in the middle?

2

2 Answers

0
votes

Have you try to use a headless service?

Istio/Kubernetes uses services to abstract the pods behind, using fix IPs is not a good practice on Kubernetes or you service mesh as they are ephemeral

0
votes

To have access to a pod you need to expose it with a service.

I dont know exactly what you want with that, but I wanted to do something similar, I will explain my problem and what I did to see if it helps anyone.

I have three pods, podA, podB and podC. Pods B and C are from the same deployment/stateful-set. PodA is the main application. I want that podA connects direct to B or C depending on the pods B and C status.

To solve that I created a cron in pods B and C that sends the ip/hostname and the statuses I want to the main application in podA, when sending requests I send with http://pod_B-OR-C_ip:port/parameters or http://pod_B-OR-C_dns:port/parameters.

The ip and hostname you can get in /etc/hosts

Hope it helps