Cannot add the external nodes as targets to prometheus-operator in kubernetes #4770
Replies: 5 comments 6 replies
-
May be there are better ways but I tested this way in local cluster and it works. We will create the the service without selector and then define the endpoints separately. And then create servicemonitor. Treat this as example and tweak settings as per your need :)
kind: Service
apiVersion: v1
metadata:
name: node-exporter-external
labels:
app: node-exporter-external
spec:
type: ClusterIP
ports:
- name: metrics
port: 9100
targetPort: 9100
kind: Endpoints
apiVersion: v1
metadata:
name: node-exporter-external
subsets:
- addresses:
- ip: <node external ip>
ports:
- name: metrics
port: 9100
protocol: TCP
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
k8s-app: node-exporter-external
name: node-exporter-external
namespace: monitoring
spec:
endpoints:
- interval: 30s
port: metrics
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app: node-exporter-external |
Beta Was this translation helpful? Give feedback.
-
The solution doesn't work in my case. I was able to add an external node export after applying the following endpoint
prometheus discovered external exporter and queried metrics |
Beta Was this translation helpful? Give feedback.
-
Since prometheus-operator 0.65, we have the apiVersion: monitoring.coreos.com/v1alpha1
kind: ScrapeConfig
metadata:
name: my-scrape-config
spec:
staticConfigs:
- targets:
- "10.x.y.z:1234" Documentation: https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1alpha1.ScrapeConfig |
Beta Was this translation helpful? Give feedback.
-
Try setting |
Beta Was this translation helpful? Give feedback.
-
Closing this discussion since ScrapeConfig is available now for this |
Beta Was this translation helpful? Give feedback.
-
Cannot add the external nodes as targets to prometheus-operator in kubernetes
My prom release on k8s is : prometheus-operator
Followed the same https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/additional-scrape-config.md
Can someone give some doc to add external node-exporter as targets to prometheus-operator in kubernetes.
Beta Was this translation helpful? Give feedback.
All reactions