Open an external port into Istio - problem only on docker-for-mac

9/5/2018

Update: This problem is only on docker-for-mac

I have been chasing this for some time now - how do you open an external port into Istio.

Note all this works on port 80, why not on port 8080?

Using helm, I have changed value in values.yaml gateways:

- port: 80
  targetPort: 80
  name: http2
  # nodePort: 31380
- port: 8080
  targetPort: 8080
  name: http2-testport
  # nodePort: 31480  

I have created a Istion Gateway:

# Istio - Gateway
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: helloworld-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http-80
      protocol: HTTP
    hosts:
    - "my-service.default.svc.cluster.local"

  - port:
      number: 8080
      name: http-8080
      protocol: HTTP
    hosts:
    - "my-service.default.svc.cluster.local"

Port 8080 is open: kubectl get svc -n istio-system

istio-ingressgateway       LoadBalancer   10.106.146.89    localhost     80:31342/TCP,443:31390/TCP,31400:31400/TCP,15011:31735/TCP,8060:32568/TCP,8080:32164/TCP,853:30443/TCP,15030:
-- Chris G.
docker-for-mac
gateway
istio
kubernetes

1 Answer

9/5/2018

You have to define a VirtualService to specify where (to which microservice) the ingress traffic must be directed, see https://istio.io/docs/tasks/traffic-management/ingress/#configuring-ingress-using-an-istio-gateway.

Also try to send the Host header with your request, e.g. with curl -H Host:my-service.default.svc.cluster.local.

See https://github.com/istio/istio.github.io/pull/2181.

-- Vadim Eisenberg
Source: StackOverflow