Monitoring Kubernetes Cluster with Prometheus, using NodePort Method

June 19, 2019 204 views
Kubernetes

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:

XXXXXXXXXXXXXXXX.k8s.ondigitalocean.com:9090

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?

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.

Regards,

John Kwiatkoski
Senior Developer Support Engineer

Have another answer? Share your knowledge.