apiVersion: monitoring.coreos.com/v1alpha1 kind: PrometheusAgent metadata: name: prometheus-agent namespace: monitoring spec: serviceMonitorNamespaceSelector: {} podMonitorNamespaceSelector: {} serviceMonitorSelector: matchExpressions: - key: app.kubernetes.io/name operator: Exists podMonitorSelector: matchExpressions: - key: app.kubernetes.io/name operator: Exists replicas: 1 remoteWrite: - url: https://prometheus.monitoring.limbosolutions.com/api/v1/write scrapeInterval: 60s resources: requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi serviceAccountName: prometheus-agent nodeSelector: role: worker-node --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: prometheus-agent rules: - apiGroups: [""] resources: ["nodes", "nodes/metrics", "nodes/proxy", "services", "endpoints", "pods"] verbs: ["get", "list", "watch"] - apiGroups: ["monitoring.coreos.com"] resources: ["servicemonitors", "podmonitors"] verbs: ["get", "list", "watch"] - nonResourceURLs: - /metrics - /metrics/cadvisor - /metrics/probes verbs: ["get"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: prometheus-agent-monitoring roleRef: kind: ClusterRole name: prometheus-agent apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount name: prometheus-agent namespace: monitoring --- apiVersion: v1 kind: ServiceAccount metadata: name: prometheus-agent namespace: monitoring