i have a 2 services. (Service A, Service B)
Service A have a domain (aaa.local.com) that resolves to localhost for local development.
Service B have a domain (bbb.local.com) that resolves to localhost for local development.
and this is gateway manifest file.
A service gateway.yaml
kind: Gateway
spec:
...
- hosts:
- aaa.local.com
---
kind: VirtualService
spec:
...
hosts:
- aaa.local.com
http:
- route:
- destination:
host: a-service
B service gateway.yaml
kind: Gateway
spec:
...
- hosts:
- bbb.local.com
---
kind: VirtualService
spec:
...
hosts:
- bbb.local.com
http:
- route:
- destination:
host: b-service
then i can test on local machine (macbook) like curl aaa.com
but in pod, it cant be success. this is because aaa.com
resolves to localhost.
i think the problem is communicating with localhost inside the pod.
if i use a service name instead of a domain like
- hosts:
- a-svc.a.svc.cluster.local
it will be fine.
but i want to use domain for local, production environments.
is there a way? thank you…
[log]
# local terminal (macbook)
curl http://aaa.local.com -i
HTTP/1.1 200 OK
...
server: istio-envoy
# pod terminal
kubectl exec -it my-pod sh
curl http://aaa.local.com -i
curl: (7) Failed to connect to aaa.com port 80: Connection refused