cluster-monitor-operator添加外部metrics
oc adm policy add-cluster-role-to-user cluster-reader system:serviceaccount:openshift-monitoring:prometheus-k8sapiVersion: v1
kind: Service
metadata:
labels:
k8s-app: bfs-data-detection
name: bfs-data-detection
namespace: bfs-webs
spec:
ports:
- name: http
port: 9103
protocol: TCP
targetPort: http
selector:
app: bfs-data-detection
type: ClusterIP
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: bfs-data-detection
# Change this to the namespace the Prometheus instance is running in
namespace: openshift-monitoring
labels:
k8s-app: bfs-data-detection
spec:
selector:
matchLabels:
k8s-app: bfs-data-detection # target bfs-data-detection service
jobLabel: k8s-app
namespaceSelector:
matchNames:
- bfs-webs
endpoints:
- port: http
scheme: http
interval: 5mLast updated