From 29bac24705483c63f2d205290e5bf83ce00a653c Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Mon, 10 Apr 2023 21:23:12 +0200 Subject: [PATCH] updates after writing blog --- etcd-inmemory-monitoring/README | 3 --- etcd-inmemory-monitoring/alertingrules.yaml | 8 ++++---- etcd-inmemory-monitoring/deployment.yaml | 20 ++++++++++++-------- etcd-inmemory-monitoring/docker-compose.yaml | 4 +--- etcd-inmemory-monitoring/service.yaml | 6 +++--- etcd-inmemory-monitoring/servicemonitor.yaml | 4 ++-- 6 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 etcd-inmemory-monitoring/README diff --git a/etcd-inmemory-monitoring/README b/etcd-inmemory-monitoring/README deleted file mode 100644 index 4f7f85a..0000000 --- a/etcd-inmemory-monitoring/README +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/prometheus/client_python -pip install prometheus-client - diff --git a/etcd-inmemory-monitoring/alertingrules.yaml b/etcd-inmemory-monitoring/alertingrules.yaml index aa4d4d3..ca71263 100644 --- a/etcd-inmemory-monitoring/alertingrules.yaml +++ b/etcd-inmemory-monitoring/alertingrules.yaml @@ -14,7 +14,7 @@ spec: summary: etcd cluster backup is too old or not present expr: |- time() - - max(max_over_time(file_time_seconds{job="pantherbackupexporter",type="backup"}[60m])) + max(max_over_time(file_time_seconds{job="controllerbackupexporter",type="backup"}[60m])) > 3600 for: 5m labels: @@ -24,7 +24,7 @@ spec: description: 'etcd backup is too small or not present' summary: etcd cluster backup is too small or not present expr: |- - max(max_over_time(file_size{job="pantherbackupexporter",type="backup"}[60m])) + max(max_over_time(file_size{job="controllerbackupexporter",type="backup"}[60m])) < 10000000 for: 5m @@ -36,7 +36,7 @@ spec: summary: etcd image file is too old or not present expr: |- time() - - max(max_over_time(file_time_seconds{job="pantherbackupexporter",type="image"}[60m])) + max(max_over_time(file_time_seconds{job="controllerbackupexporter",type="image"}[60m])) > 3600 for: 5m labels: @@ -46,7 +46,7 @@ spec: description: 'etcd image file is too small or not present' summary: etcd cluster image file is too small or not present expr: |- - max(max_over_time(file_size{job="pantherbackupexporter",type="image"}[60m])) + max(max_over_time(file_size{job="controllerbackupexporter",type="image"}[60m])) < 10 for: 5m diff --git a/etcd-inmemory-monitoring/deployment.yaml b/etcd-inmemory-monitoring/deployment.yaml index c0846c6..a1da9b6 100644 --- a/etcd-inmemory-monitoring/deployment.yaml +++ b/etcd-inmemory-monitoring/deployment.yaml @@ -1,17 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: pantherbackupmonitoring + name: controllerbackupmonitoring namespace: monitoring spec: selector: matchLabels: - app: pantherbackupmonitoring + app: controllerbackupmonitoring template: metadata: labels: - app: pantherbackupmonitoring - prometheus-scrapable: "true" + app: controllerbackupmonitoring spec: terminationGracePeriodSeconds: 0 tolerations: @@ -21,8 +20,13 @@ spec: - effect: NoSchedule key: node-role.kubernetes.io/master operator: Exists - nodeSelector: - kubernetes.io/hostname: panther + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: node-role.kubernetes.io/control-plane + operator: Exists containers: - name: exporter image: docker.example.com/filemonitor:1.0 @@ -37,11 +41,11 @@ spec: protocol: TCP name: http volumeMounts: - - name: pantherbackup + - name: controllerbackup mountPath: /backup readOnly: true volumes: - - name: pantherbackup + - name: controllerbackup hostPath: path: /var/lib/wamblee/etcd diff --git a/etcd-inmemory-monitoring/docker-compose.yaml b/etcd-inmemory-monitoring/docker-compose.yaml index 30aec21..9613e47 100644 --- a/etcd-inmemory-monitoring/docker-compose.yaml +++ b/etcd-inmemory-monitoring/docker-compose.yaml @@ -6,14 +6,12 @@ services: command: - python3 - /exporter.py - # some paths for testing - /data/x.txt - /data/y.txt ports: - "8080:8080" volumes: - # for testing. - - /home/user/downloads:/data + - /home/erik/downloads:/data diff --git a/etcd-inmemory-monitoring/service.yaml b/etcd-inmemory-monitoring/service.yaml index 5fc08b7..f17c1d9 100644 --- a/etcd-inmemory-monitoring/service.yaml +++ b/etcd-inmemory-monitoring/service.yaml @@ -2,13 +2,13 @@ apiVersion: v1 kind: Service metadata: - name: pantherbackupexporter + name: controllerbackupexporter namespace: monitoring labels: - app: pantherbackupmonitoring + app: controllerbackupmonitoring spec: selector: - app: pantherbackupmonitoring + app: controllerbackupmonitoring ports: - port: 8080 targetPort: 8080 diff --git a/etcd-inmemory-monitoring/servicemonitor.yaml b/etcd-inmemory-monitoring/servicemonitor.yaml index eec6713..64d7446 100644 --- a/etcd-inmemory-monitoring/servicemonitor.yaml +++ b/etcd-inmemory-monitoring/servicemonitor.yaml @@ -1,7 +1,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: pantherbackupmonitoring + name: controllerbackupmonitoring namespace: monitoring spec: endpoints: @@ -12,6 +12,6 @@ spec: scrapeTimeout: 30s selector: matchLabels: - app: pantherbackupmonitoring + app: controllerbackupmonitoring targetLabels: - app