Kubernetes - Have an ingress on a service - is it ok for its type to be ClusterIP

3/5/2019

I have a Kubernetes services that I would like to be accessible from outside the cluster.

I've setup Traefik and have created an Ingress file for that service and am able to go to 'somemadeupdomain.com' and access the service fine. (Having locally added a line in my hosts file).

However my question is with the service type, I've currently set as ClusterIP. I can access the service fine, so is it fine to continue to use that or should I use NodePort.

Of course if I use NodePort I'm aware that when doing minikube service list I'll get a specific URL created by Kubernetes to access that service, but I feel I don't need to do that as I have that ingress file?

Any explanation would be appreciated.

Thanks

-- userMod2
kubernetes
minikube

2 Answers

3/5/2019

As you are using ingress already it does not make much sense to use NodePort. As you already have a way to access your application. Its totally fine to have a service type you need at service level that you need for the internal access(within Kubernets) purpose.

-- Pramod V
Source: StackOverflow

3/11/2019

Ingress will redirect your external traffic to your service within the cluster, so ClusterIP is a good choice. No need to use NodePort. From Documentation

Ingress, added in Kubernetes v1.1, exposes HTTP and HTTPS routes from outside the cluster to services within the cluster

-- coolinuxoid
Source: StackOverflow