So I have successfully deployed istio, atleast I think so, everything seems to work fine. I have deployed my API in Istio and I can reach it through my browser. I can even test my API using postman, but when I try to reach my API through curl it says The remote name could not be resolved: 'api.localhost'
. That was the first red flag but I ignored it. Now I'm trying to reach my API from my webapp but Chrome responds with net:ERR_FAILED
.
It seems like my services are only available for the host, which is me, and nothing else. I can't seem to find a solution for this on the internet so I hope someone has expirience and knows a fix.
Thanks!
EDIT: More information
My infrastructure is all local, Docker for Desktop with Kubernetes. The Istio version I'm using is 1.5.0.
Gateway:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: api-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http-api
protocol: HTTP
hosts:
- "api.localhost"
Virtual service:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: pb-api
spec:
gateways:
- api-gateway
hosts:
- "*"
http:
- match:
- uri:
prefix: /
rewrite:
uri: /
route:
- destination:
host: pb-api
port:
number: 3001
When I try to do curl http://api.localhost/user/me
I expect a 401
, but instead I get The remote name could not be resolved: 'api.localhost'
as stated above. That error is just the same as when I turn off Docker for desktop and try again. Through postman and the browser it works fine, but curl and my react webapp can't reach it.