For this you would need Few Items
- Endpoints
- Service
- ServiceMonitor
---
apiVersion: v1
kind: Endpoints
metadata:
name: onprem-proxy
namespace: monitoring
subsets:
- addresses:
- ip: "192.168.10.10"
- ip: "192.168.10.11"
ports:
- name: 'onprem-proxy-metrics'
protocol: TCP
port: 9100
---
apiVersion: v1
kind: Service
metadata:
name: onprem-proxy
namespace: monitoring
labels:
app.kubernetes.io/name: onprem-proxy
spec:
ports:
- name: "onprem-proxy-metrics"
protocol: TCP
port: 9100
targetPort: 9100
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: onprem-proxy
namespace: monitoring
spec:
endpoints:
- interval: 10s
path: /metrics
port: onprem-proxy-metrics
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/name: onprem-proxy
Comments
Post a Comment