Skip to content

Latest commit

 

History

History
44 lines (40 loc) · 893 Bytes

File metadata and controls

44 lines (40 loc) · 893 Bytes

Note: Starting with v0.39.0, Prometheus Operator requires use of Kubernetes v1.16.x and up.

Basic auth for targets

To authenticate a ServiceMonitors over a metrics endpoint use basicAuth

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    k8s-apps: basic-auth-example
  name: basic-auth-example
spec:
  endpoints:
  - basicAuth:
      password:
        name: basic-auth
        key: password
      username:
        name: basic-auth
        key: user
    port: metrics
  namespaceSelector:
    matchNames:
    - logging
  selector:
    matchLabels:
      app: myapp
apiVersion: v1
kind: Secret
metadata:
  name: basic-auth
data:
  password: dG9vcg== # toor
  user: YWRtaW4= # admin
type: Opaque