diff --git a/examples/kubernetes/daemonset.yaml b/examples/kubernetes/daemonset.yaml index 3a92159..f7a7e42 100644 --- a/examples/kubernetes/daemonset.yaml +++ b/examples/kubernetes/daemonset.yaml @@ -3,11 +3,11 @@ kind: DaemonSet metadata: name: systemd-exporter labels: - name: systemd-exporter + app.kubernetes.io/name: systemd-exporter spec: selector: matchLabels: - k8s-app: systemd-exporter + app.kubernetes.io/name: systemd-exporter updateStrategy: rollingUpdate: maxUnavailable: 100% @@ -15,24 +15,21 @@ spec: template: metadata: labels: - k8s-app: systemd-exporter - annotations: - prometheus.io/scrape: "true" - prometheus.io/path: "/metrics" - prometheus.io/port: "9558" + app.kubernetes.io/name: systemd-exporter spec: securityContext: runAsUser: 0 hostPID: true + hostNetwork: true containers: - name: systemd-exporter - image: quay.io/prometheuscommunity/systemd-exporter:master + image: prometheuscommunity/systemd-exporter securityContext: privileged: true args: - --log.level=info - --path.procfs=/host/proc - - --collector.unit-whitelist=kubelet.service|docker.service + - --systemd.collector.unit-include=kubelet.service|docker.service|containerd.service ports: - name: metrics containerPort: 9558 diff --git a/examples/kubernetes/podmonitor.yaml b/examples/kubernetes/podmonitor.yaml new file mode 100644 index 0000000..7040973 --- /dev/null +++ b/examples/kubernetes/podmonitor.yaml @@ -0,0 +1,17 @@ +# requires that you have deployed the PodMonitor CRD (comes with Prometheus) +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: systemd-exporter + labels: + app.kubernetes.io/name: systemd-exporter-podmonitor +spec: + podMetricsEndpoints: + - port: metrics + path: "/metrics" + interval: 30s + scrapeTimeout: 10s + jobLabel: systemd-exporter + selector: + matchLabels: + app.kubernetes.io/name: systemd-exporter