Configuring Prometheus with Prometheus Operator
Jump to navigation
Jump to search
External
- https://coreos.com/operators/prometheus/docs/0.17.0/index.html
- https://github.com/prometheus-operator/prometheus-operator
Internal
Overview
Add a Target
To add a monitoring target, deploy a ServiceMonitor custom resource:
namespace="prometheus"
cat <<EOF | kubectl -n ${namespace} apply -f -
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: pushgateway-example
namespace: ${namespace}
labels:
release: prometheus
spec:
endpoints:
- path: /metrics
port: "9091"
namespaceSelector:
matchNames:
- ${namespace}
selector:
matchLabels:
function: pushgateway
EOF