Jake Davis
Jake Davis

Reputation: 71

How to access port on host from Istio Ingress Gateway

Using Kind for running a local Kubernetes cluster on Docker Desktop for Mac, I am trying to connect to a service on the host machine from an Istio ingress gateway but I receive 503 errors:

"GET / HTTP/2" 503 NC cluster_not_found - "-" 0 0 0 - "10.244.0.57" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" "c4ecc27a-2fa0-470f-bd48-2894a381c1af" "app.helloworld.app" "-" - - 127.0.0.1:443 127.0.0.1:46674 app.helloworld.app -

My current config for the service is:

apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: app-gateway-istio
  namespace: istio-ingress
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - app.helloworld.app
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: app-cert  
    hosts:
    - app.helloworld.app
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: app-virtual-service-istio
  namespace: istio-ingress
spec:
  hosts:
  - app.helloworld.app 
  gateways:
  - app-gateway-istio
  http:
    - route:
      - destination:
          host: host.docker.internal 
          port:
            number: 19006
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
 name: app-gateway-service-disable-mtls
spec:
 host: host.docker.internal
 trafficPolicy:
   tls:
     mode: DISABLE

(due to resource limitations I am unable to run the service within the kubernetes cluster)

Upvotes: 0

Views: 485

Answers (1)

Jake Davis
Jake Davis

Reputation: 71

I fixed this by adding the following config:

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: docker-ext
spec:
  hosts:
  - host.docker.internal
  ports:
  - number: 19006
    name: http
    protocol: HTTP
  resolution: DNS
  location: MESH_EXTERNAL

Upvotes: 1

Related Questions