add monitoring to crunchy postgres

This commit is contained in:
Joseph Hanson 2024-10-21 13:12:49 -05:00
parent be0f0bc52e
commit a786069bcc
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
3 changed files with 46 additions and 1 deletions

View file

@ -5,6 +5,7 @@ kind: Kustomization
resources: resources:
- ./externalsecret.yaml - ./externalsecret.yaml
- ./gatus.yaml - ./gatus.yaml
- ./podmonitor.yaml
- ./postgrescluster.yaml - ./postgrescluster.yaml
- ./pushsecret.yaml - ./pushsecret.yaml
- ./service.yaml - ./service.yaml

View file

@ -0,0 +1,38 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/monitoring.coreos.com/podmonitor_v1.json
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: cpgo-postgres
spec:
jobLabel: cpgo-postgres
namespaceSelector:
matchNames:
- database
podMetricsEndpoints:
- honorLabels: true
path: /metrics
port: exporter
relabelings:
- sourceLabels:
[
"__meta_kubernetes_namespace",
"__meta_kubernetes_pod_label_postgres_operator_crunchydata_com_cluster",
]
targetLabel: pg_cluster
separator: "/"
replacement: "$1$2"
- sourceLabels:
[
__meta_kubernetes_pod_label_postgres_operator_crunchydata_com_instance,
]
targetLabel: deployment
- sourceLabels:
[__meta_kubernetes_pod_label_postgres_operator_crunchydata_com_role]
targetLabel: role
- sourceLabels: [__meta_kubernetes_pod_name]
targetLabel: instance
selector:
matchLabels:
postgres-operator.crunchydata.com/cluster: postgres
postgres-operator.crunchydata.com/crunchy-postgres-exporter: "true"

View file

@ -23,7 +23,13 @@ spec:
pgmonitor: pgmonitor:
exporter: exporter:
# https://github.com/CrunchyData/postgres-operator-examples/blob/main/helm/install/values.yaml # https://github.com/CrunchyData/postgres-operator-examples/blob/main/helm/install/values.yaml
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-3 # image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-12
resources:
requests:
cpu: 10m
memory: 64M
limits:
memory: 512M
patroni: # turn on sync writes to at least 1 other replica patroni: # turn on sync writes to at least 1 other replica
dynamicConfiguration: dynamicConfiguration: