kubernetes: What kind of port should I use to expose a service behind an ingress?

3/16/2018

What is the correct way to expose a service behind an ingress. Should I use nodePort? clusterIp? something else? because most tutorials just ignore this point. and some show the service using a nodePort and then add something like "would be enough for this demo" which isn't very reassuring.

-- alonisser
azure-kubernetes
kubernetes

1 Answer

3/16/2018

Services behind an ingress may simply be ClusterIP. The only reason you'd need NodePort is if you had some external LoadBalancer or something where you needed a static port on which you can access the service inside the cluster. As ingresses route traffic within the cluster, you can just use ClusterIP.

-- Grant David Bachman
Source: StackOverflow