Monitoring Kubernetes Cluster with Prometheus, using NodePort Method

Posted June 19, 2019 1.8k views

Hello everyone.

I’m implementing a solution in Kubernetes for several clients, and I want to monitoring my cluster with Prometheus. However, because this can scale quickly, and I want to reduce costs, I will use Federation for Prometheus, to scrape different clusters of Kubernetes, but I need to expose my Prometheus deployment.

I already have that working with a service type LoadBalancer exposing my Prometheus deployment, but this approach add this extra expense to my infra structure (Digital Ocean LB).

Is it possible to make this using a service type NodePort, exposing a port to my Cluster IP, something like this:

Where I can use this URL to my master Prometheus scrappe all “slaves” Prometheus instances?

I already tried, but I can’t reach my cluster port. Something is blocking. I also delete my firewall, to ensure that nothing is interferes in this implementation but nothing.

Can anybody help me please?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

Unfortunately there is no IP or FQDN that can resolve that nodeport service that is currently available outside creating a LB service. If you wish you can provision your own smaller droplet to point to all nodes to save on cost, however that would need to be manually adjusted as nodes get recycled/added/removed and their IP’s change.

Manually deleting or editing any of the DOKS generated cloud resources, would not be an ideal solution as the firewall is managed by the Cloud Controller manager and will be regenerated during the next reconcile process.

The URL you provided resolves to the master which wouldnt have that port listening unfortunately only the nodes.


John Kwiatkoski
Senior Developer Support Engineer