Skip to content

Commit

Permalink
chore(cnpg): experiment prometheus/grafana monitoring for CloudNativePG
Browse files Browse the repository at this point in the history
  • Loading branch information
mborne committed Jun 3, 2024
1 parent 0205ea5 commit 7066db9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
6 changes: 6 additions & 0 deletions cnpg/k8s-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ helm upgrade --install cnpg \
--create-namespace \
cnpg/cloudnative-pg

# Wait for cert-manager pods to be ready
kubectl -n cert-manager wait \
--for=condition=ready pod \
--selector=app.kubernetes.io/name=cloudnative-pg \
--timeout=90s

kubectl -n cnpg apply -f "${SCRIPT_DIR}/manifest/postgis-cluster.yaml"
6 changes: 6 additions & 0 deletions cnpg/k8s-uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

kubectl -n cnpg delete cluster/postgis-cluster

helm uninstall cnpg \
--namespace cnpg
5 changes: 5 additions & 0 deletions cnpg/manifest/postgis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@ spec:
database: gis
postInitTemplateSQL:
- CREATE EXTENSION postgis;

storage:
size: 10Gi

# https://cloudnative-pg.io/documentation/current/quickstart/#viewing-with-prometheus
monitoring:
enablePodMonitor: true
5 changes: 5 additions & 0 deletions grafana/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ dashboards:
revision: 5
datasource: Prometheus
editable: true
# https://github.com/cloudnative-pg/grafana-dashboards/tree/main/charts/cluster
cloudnativepg:
url: https://raw.githubusercontent.com/cloudnative-pg/grafana-dashboards/main/charts/cluster/grafana-dashboard.json
datasource: Prometheus
editable: true

# downloadDashboards:
# env:
Expand Down
10 changes: 5 additions & 5 deletions prometheus/helm/prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ grafana:

prometheus:
prometheusSpec:
# https://medium.com/@lambdaEranga/monitor-kubernets-services-endpoints-with-prometheus-blackbox-exporter-a64e062c05d5
serviceMonitorNamespaceSelector: {} # get service monitors on all namespaces
serviceMonitorSelectorNilUsesHelmValues: false
# ServiceMonitor
ruleSelectorNilUsesHelmValues: false
ruleNamespaceSelector: {}
serviceMonitorSelector: {} # get all existing service monitors
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
probeSelectorNilUsesHelmValues: false
scrapeConfigSelectorNilUsesHelmValues: false
# keep annotations based scrapping
# https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446711073
additionalScrapeConfigs:
Expand Down

0 comments on commit 7066db9

Please sign in to comment.