Kubernetes - Accessing a ClusterIP service using Minikube

3/4/2019

I've had my services set with type NodePort however in reality external access it not required - they only need to be able to talk to each other.

Therefore I presume I should change these to the default ClusterIP however the question is - how can I continue to access these services during my local development?

So when i make the change from NodePort to ClusterIP then go to minikube service list it naturally shows no node port however how can I now access - is there some special endpoint address I can get from somewhere?

Thanks.

-- userMod2
kubernetes
minikube

2 Answers

3/4/2019

You would need to access it like any other out-of-cluster case. Generally this means either kubectl port-forward or kubectl proxy, I favor the former though. In general, ClusterIP services are only accessible from inside the cluster, accessing through forwarders is only used for debugging or infrequent access.

-- coderanger
Source: StackOverflow

3/4/2019

Since you have 10 such services, I believe using an Ingress Controller will be a better option here. I have worked on a similar scenario, where we would want to access our services directly in local or QA environment and not in Production.

We used Nginx Ingress Controller. You may get more details about ingress here. It was fairly simple to setup and well served the purpose.

Thanks!

-- Gaurav Gahlot
Source: StackOverflow