diff --git a/kubernetes/apps/database/crunchy-postgres-operator/cluster/kustomization.yaml b/kubernetes/apps/database/crunchy-postgres-operator/cluster/kustomization.yaml index ef1ce0d0..a89bb946 100644 --- a/kubernetes/apps/database/crunchy-postgres-operator/cluster/kustomization.yaml +++ b/kubernetes/apps/database/crunchy-postgres-operator/cluster/kustomization.yaml @@ -5,6 +5,7 @@ kind: Kustomization resources: - ./externalsecret.yaml - ./gatus.yaml + - ./podmonitor.yaml - ./postgrescluster.yaml - ./pushsecret.yaml - ./service.yaml diff --git a/kubernetes/apps/database/crunchy-postgres-operator/cluster/podmonitor.yaml b/kubernetes/apps/database/crunchy-postgres-operator/cluster/podmonitor.yaml new file mode 100644 index 00000000..1afb583c --- /dev/null +++ b/kubernetes/apps/database/crunchy-postgres-operator/cluster/podmonitor.yaml @@ -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" diff --git a/kubernetes/apps/database/crunchy-postgres-operator/cluster/postgrescluster.yaml b/kubernetes/apps/database/crunchy-postgres-operator/cluster/postgrescluster.yaml index d5ee4f97..7d8d9e82 100644 --- a/kubernetes/apps/database/crunchy-postgres-operator/cluster/postgrescluster.yaml +++ b/kubernetes/apps/database/crunchy-postgres-operator/cluster/postgrescluster.yaml @@ -23,7 +23,13 @@ spec: pgmonitor: exporter: # 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 dynamicConfiguration: