MelanieOL
MelanieOL

Reputation: 25

Kubernetes Prometheus node exporter not targeting good one

I deploy prometheus-node-exporter helm chart (https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-node-exporter), the installation is working, this is a DaemonSet, so one pod per node.

My prometheus server is outside of my k8s cluster, so I need to expose the service to give access to metrics to prometheus. To do that, I change the Type of service to NodePort. That's mean, the port has been open on every nodes of my cluster.

So I add IP:Port on prometheus of each cluster node, but it looks like sometimes, a IP:Port point to another node... looks like K8S is loadbalancing the incoming request ?

Someone already got this issue with NodePort ?

Thanks

Upvotes: 0

Views: 880

Answers (1)

MelanieOL
MelanieOL

Reputation: 25

The solution is to set the externalTrafficPolicy of the service to Local. In this way, the request will stay in the targeted node.

Upvotes: 0

Related Questions