Why can I not connect to my service, even though I have an endpoint?

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.21
Cloud being used: bare-metal
Installation method: rancherD
Host OS: CentOS 7.9
CNI and version: whatever rancherd version v2.5.8 provides
CRI and version: whatever rancherd version v2.5.8 provides, containerd?


I have installed elasticsearch using helm and now I wonder how I can access my service. I do have a service defined:

kubectl get svc -n elasticfluent

elasticsearch-master ClusterIP 9200/TCP,9300/TCP 3d20h
elasticsearch-master-headless ClusterIP None 9200/TCP,9300/TCP 3d20h

I also note that I have some endpoints at that service:

kubectl get endpoints -n elasticfluent

elasticsearch-master,, + 3 more… 3d20h
elasticsearch-master-headless,, + 3 more… 3d20h

But, if I try to curl one of those endpoints, I get connection refused:


curl: (7) Failed connect to; Connection refused

I found a tutorial based on minicube that suggest I should use port-forward to expose a port. If I try that, it works. But, that clearly is not how it is supposed to work in production. At least I know that my service works, since then elasticsearch answers.

So, how are you really supposed to expose that service? I do note that I do not have an “External IP” on my service. Is that what I need?

Pointers appreciated.

Your service is internal to the cluster only, to expose it externally it must be of type NodePort or LoadBalancer (requires integration with another service), or through an Ingress.

I highly recommend looking more into how Kubernetes networking functions to understand how these things work together. It will help you greatly moving forward.

Here is a vid that covers the different service types:

Thank! That explained what the port forwarding was, and why that worked.

Now I have found now issues, when setting up my Ingress, but that will have to be another topic.