Skip to content

Latest commit

 

History

History
178 lines (127 loc) · 4.21 KB

File metadata and controls

178 lines (127 loc) · 4.21 KB

Postgres AI monitoring - Helm chart installation guide

Installation

1. Download Helm chart

2. Create namespace

kubectl create namespace postgres-ai-mon

3. Create custom-values.yaml

existingSecret:
  name: postgres-ai-monitoring-secrets

global:
  clusterName: my-cluster
  nodeName: my-node
  customTags:
    env: production

monitoredDatabases:
  - name: my-db
    host: db-host.example.com
    port: 5432
    database: postgres
    user: postgres_ai_mon
    passwordSecretKey: my-db-password
    presetMetrics: full
    isEnabled: true
    group: production

grafana:
  enabled: true
  admin:
    existingSecret: postgres-ai-monitoring-secrets
    userKey: grafana-admin-user
    passwordKey: grafana-admin-password
  service:
    type: ClusterIP

ingress:
  enabled: true
  className: nginx
  hosts:
    grafana: monitoring.example.com

storage:
  postgresSize: 100Gi
  victoriaMetricsSize: 200Gi
  storageClassName: standard

Customize: clusterName, monitoredDatabases, ingress.hosts, and storageClassName.

4. Create secret

kubectl create secret generic postgres-ai-monitoring-secrets \
  --namespace postgres-ai-mon \
  --from-literal=postgres-password='SINK_POSTGRES_PASSWORD' \
  --from-literal=grafana-admin-user='monitor' \
  --from-literal=grafana-admin-password='GRAFANA_PASSWORD' \
  --from-literal=pgai-api-key='POSTGRES_AI_API_KEY' \
  --from-literal=db-password-my-db-password='DB_PASSWORD'

Notes:

  • SINK_POSTGRES_PASSWORD should be generated by you and will be used to connect to the internal database for storing metrics
  • GRAFANA_PASSWORD should be generated by you and will be used to access grafana
  • POSTGRES_AI_API_KEY should be attained from PostgresAI platform and will be used to connect to the PostgresAI platform
  • Add --from-literal for each database that you want to monitor
    • Key must match passwordSecretKey in custom-values.yaml
    • Key name must be db-password-<passwordSecretKey> and value must be the password for monitoring user in the database

5. Install helm chart

helm install postgres-ai-monitoring ./postgres-ai-monitoring-0.12.tgz \
  --namespace postgres-ai-mon \
  --values custom-values.yaml

6. Verify installation

kubectl get pods -n postgres-ai-mon

Access grafana

Port Forward (quick access):

kubectl port-forward -n postgres-ai-mon svc/postgres-ai-monitoring-grafana 3000:80

Open: http://localhost:3000

Ingress: Access via configured domain (e.g., http://monitoring.example.com)

Login: Username and password from the secret (grafana-admin-user / grafana-admin-password)

Common tasks

Update configuration

helm upgrade postgres-ai-monitoring ./postgres-ai-monitoring-0.12.tgz \
  --namespace postgres-ai-mon \
  --values custom-values.yaml

Add database

  1. Add entry to monitoredDatabases in custom-values.yaml

  2. Add password to secret:

kubectl create secret generic postgres-ai-monitoring-secrets \
  --namespace postgres-ai-mon \
  --from-literal=new-db-password='password' \
  --dry-run=client -o yaml | kubectl apply -f -
  1. Run helm upgrade

Check logs

kubectl logs -n postgres-ai-mon <pod-name>

Uninstall

1. Uninstall Helm release

helm uninstall postgres-ai-monitoring --namespace postgres-ai-mon

This removes all resources created by the Helm chart, but preserves PersistentVolumeClaims and secrets.

2. Delete PersistentVolumeClaims (optional)

Warning: This will permanently delete all stored metrics and Grafana data.

kubectl delete pvc -n postgres-ai-mon --all

Or delete specific PVCs:

kubectl delete pvc -n postgres-ai-mon data-postgres-ai-monitoring-sink-postgres-0
kubectl delete pvc -n postgres-ai-mon data-postgres-ai-monitoring-victoriametrics-0

3. Delete secrets (optional)

kubectl delete secret -n postgres-ai-mon postgres-ai-monitoring-secrets

4. Delete namespace (optional)

Warning: This will delete all resources in the namespace, including any data stored in PersistentVolumes.

kubectl delete namespace postgres-ai-mon

Note: Before deleting the namespace, ensure no other applications are using it.