prole/knoe-db/supabase.md

2.8 KiB

Supabase Integration for Knoe-DB

This document explains how Supabase is deployed alongside the Knoe CloudNative-PG (CNPG) cluster and how it connects to Postgres. It provides practical guidance for operating and troubleshooting the integration.

What is deployed

Supabase can be deployed alongside the Knoe CNPG cluster. Currently, the base supabase/supabase image is unavailable on Docker Hub, so the default deployment manifests have been removed.

If you wish to deploy Supabase, you can use the ./supabase/deploy.sh script which uses the official Supabase repository and its Docker Compose setup to generate Kubernetes manifests.

Postgres connectivity

Supabase connects to the CNPG primary via the service knoe-db-rw on port 5432. This service is managed by CNPG and always routes to the primary pod (selectors are CNPG-managed, e.g.):

  • cnpg.io/cluster: knoe-db
  • role: primary

The database credentials come from the existing secret:

  • Secret name: knoe-db-user
  • Keys: username, password

HTTPS endpoint

Supabase is exposed via a ClusterIP service on port 443. The deployment assumes the Supabase container listens on HTTPS at port 443.

If your Supabase image expects a different port, update your custom manifests.

Optional feature toggle

Supabase is an optional feature in the installer UI. The user intent is saved in knoe.cfg under the section [Optional Features] with the key:

  • SUPABASE_ENABLED = true|false

This is for configuration tracking; it does not automatically add or remove Kubernetes resources. Deployment is controlled by the k8s/knoe/kustomization.yaml resources list.

How to use (quick start)

  1. Ensure CNPG is deployed and healthy.

  2. Ensure the knoe-db-user secret exists (the init scripts or OpenBao flow should already create it).

  3. Apply the Knoe kustomization (includes Supabase resources):

kubectl apply -k k8s/knoe
  1. Verify Supabase and Postgres services:
kubectl get deploy supabase
kubectl get svc supabase
kubectl get svc knoe-db-rw
  1. Check Supabase logs if needed:
kubectl logs -n supabase -l app=supabase

Updating the Postgres target

If you need Supabase to connect to a different CNPG cluster name or namespace, update your configuration.

Troubleshooting

  • If Supabase cannot connect to Postgres, confirm:

    • The knoe-db cluster is healthy and a primary is elected.
    • The knoe-db-rw service resolves to the primary pod.
    • The knoe-db-user secret exists and contains valid credentials.
  • If HTTPS does not respond:

    • Confirm the Supabase image listens on port 443.
    • Check the container port and service port in the manifests.

Files referenced

  • knoe-db-postgres-service.yaml (optional legacy service; Supabase uses knoe-db-rw)
  • k8s/knoe/kustomization.yaml
  • install.py (optional feature toggle persistence)
  • ./supabase/deploy.sh