I am running service mesh using minikube and trying to access api running outside the minikube using fortio :
kubectl exec "$FORTIO_POD" -c fortio -- /usr/bin/fortio load -c 1 -qps 0 -n 1 -loglevel debug http://localhost:3000
but this is giving me error :
dial tcp 127.0.0.1:3000: connect: connection refused
Below is the service entry and destinationRule object I have created :
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: localhost
spec:
hosts:
- localhost
location: MESH_EXTERNAL
ports:
- number: 3000
name: http
protocol: HTTP
resolution: STATIC
endpoints:
- address: 127.0.0.1
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: localhost
spec:
host: localhost
trafficPolicy:
tls:
mode: DISABLE
sni: localhost.local
I believe what you are trying here is to access an API which is hosted in the host system from within Minikube. You can't expect to connect to host system just by creating a localhost service entry in istio. For minikube host access you need to use
host.minikube.internal
Refer this link: https://minikube.sigs.k8s.io/docs/handbook/host-access/