Accessing TCP port using istio ingress gateway outside the cluster

1/25/2019

I have my gateway setup this way

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
  namespace: dev
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - hosts:
    - "bitcoin-testnet-zmq.my.net"    
    port:
      number: 48832
      protocol: tcp
      name: bitcoin-zmq-testnet
  - hosts:
    - "*"
    port:
      number: 80
      protocol: http
      name: bitcoin-mainnet

Virtual service like this

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bitcoin-testnet-zmq
  namespace: dev
spec:
  hosts:
    - "bitcoin-testnet-zmq.my.net"
  gateways:
  - my-gateway    
  tcp:
  - match:
    - port: 48832
    route:
    - destination:
        port:
          number: 48832
          name: bitcoin-zmq-testnet
        host: bitcoinrpc-testnet-dev-service

and my service is as follows

kind: Service
apiVersion: v1
metadata:
  name: bitcoinrpc-testnet-dev-service
  namespace: dev
spec:
  selector:
    app: bitcoin-node-testnet
  ports:
  - name: bitcoin-testnet
    protocol: TCP
    port: 80
    targetPort: 18332
  - name: bitcoin-zmq-testnet
    protocol: TCP
    port: 48832
    targetPort: 48832    
  type: NodePort

When I login to a pod in the same namespace and do telnet bitcoinrpc-testnet-dev-service 48832, then it can connect. Also, found that all the other http serviecs can be accessed correctly through the istio-gateway

-- kosta
istio
kubernetes-ingress

1 Answer

1/28/2019

I don't see an issue with your configurations, actually that's the usage of the istio Gateway, to allow external access to your services.

-- kornshell93
Source: StackOverflow