How to open a custom port on the istio-ingressgateway

By default, when you deploy istio on a Kubernetes cluster, it will create a load balancer name istio-ingressgateway [1]. That ingress gateway is a Kubernetes's LoadBalancer resource that helps handling incoming traffic into the mesh. You can check by running this command:

kubectl -n istio-system get service istio-ingressgateway

The istio-ingressgateway load balancer will open a number of ports such as 80, 443, etc. If you want to open a new port on the load balancer, you can do like the following:

1. Export the current configuration of the istio-ingressgateway

kubectl -n istio-system get service istio-ingressgateway -o yaml > istio_ingressgateway.yaml

2. Edit the istio_ingressgateway.yaml, add the new port you want, for example

nano istio_ingressgateway.yaml

  - name: myport
    nodePort: 31410
    port: 5000
    protocol: TCP
    targetPort: 5000

3. Apply the new configuration

kubectl apply -f istio_ingressgateway.yaml

4. Check if the new port running

kubectl describe svc istio-ingressgateway -n istio-system | less