Databases
PostgreSQL, MongoDB, Valkey, ClickHouse, and Elasticsearch on the SDP: provisioning, connections, high availability, and monitoring.
The SDP runs databases as Kubernetes workloads inside your cluster. For each supported engine, this page covers the same four topics: how it is provisioned, how your application connects, how high availability works, and how you monitor it.
| Engine | Use case | Technology / Polycrate block | High availability |
|---|---|---|---|
| PostgreSQL | Relational database | CloudNativePG operator (ayedo/k8s/cloudnative-pg) |
Yes: primary plus streaming replicas with automatic failover |
| MongoDB | Document database | MongoDB Community Operator (ayedo/k8s/mongodb-operator) |
Yes: replica set with automatic primary election |
| Valkey | In-memory key-value store (Redis-compatible) | ayedo/k8s/valkey |
No: single instance with a persistent volume |
| ClickHouse | Columnar analytics database | Official ClickHouse server image (ayedo/k8s/clickhouse) |
Default: single instance; replication on request |
| Elasticsearch | Search and analytics engine | Elastic Cloud on Kubernetes (ECK, ayedo/k8s/eck-operator) |
Yes: multiple nodes via nodeSets |
Common Ground
Provisioning: In managed operation, you order a database through the app catalog or by contacting us. ayedo installs and runs it in your cluster and tells you the namespace, Service, and Secret to use. If you operate the platform yourself, you install the matching Polycrate block from the Hub, for example with polycrate run <block> install. Who is responsible for what is described in Operating Models.
Credentials: Every engine stores its credentials in a Kubernetes Secret. Reference them in your Deployments via secretKeyRef, or sync them from OpenBao with the External Secrets Operator. Never commit passwords to Git in plain text.
Reachability: By default, databases are only reachable inside the cluster through a ClusterIP Service (<service>.<namespace>.svc.cluster.local). For administrative access from your workstation, use kubectl port-forward (see Access & Identity).
Storage: Databases need ReadWriteOnce block storage. Suitable StorageClasses are listed in Storage.
Monitoring: Metrics go to VictoriaMetrics and logs to VictoriaLogs. You explore both in Grafana and define your own alerts there (see Observability).
PostgreSQL (CloudNativePG)
Provisioning
The CloudNativePG operator manages PostgreSQL clusters declaratively through the Cluster custom resource. In managed operation, ayedo creates the cluster for you (PostgreSQL in the app catalog). Once the operator is installed in your cluster, you can also declare additional database clusters yourself as a Cluster resource in your namespace:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: acme-db
namespace: acme-prod
spec:
instances: 3
storage:
size: 50Gi
bootstrap:
initdb:
database: app
owner: app
Check its state with kubectl get cluster -n acme-prod and kubectl describe cluster acme-db -n acme-prod.
Connecting
CloudNativePG creates three Services per cluster:
| Service | Target | Use |
|---|---|---|
<cluster>-rw |
current primary | read and write traffic from your application |
<cluster>-ro |
replicas only | reporting and read-heavy queries |
<cluster>-r |
all instances | reads including the primary |
Credentials for the application database live in the Secret <cluster>-app (including username, password, host, port, dbname, and uri):
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: acme-db-app
key: uri
CloudNativePG enables TLS by default. Connect with at least sslmode=require; for sslmode=verify-full, the CA certificate is in the Secret <cluster>-ca (key ca.crt). If your application opens many short-lived connections, put a PgBouncer pooler (Pooler resource) in front of the database and point your application at the pooler's Service instead of <cluster>-rw.
High Availability
A production cluster runs three instances: one primary and two streaming replicas, spread across nodes with pod anti-affinity. If the primary fails, the operator promotes an up-to-date replica and switches the <cluster>-rw Service over. Failovers and rolling updates briefly drop existing connections, so give your application reconnect and retry logic. For updates to roll through without interruption, your cluster should have more worker nodes than database instances (see the reference sizing in Operating Models).
Monitoring
Every instance exposes PostgreSQL and replication metrics that VictoriaMetrics collects. In Grafana, keep an eye on connections, replication lag, volume usage, and the WAL archiving status.
MongoDB
Provisioning
MongoDB runs as a replica set managed by the MongoDB Community Operator through the MongoDBCommunity custom resource (MongoDB in the app catalog, block ayedo/k8s/mongodb-operator). Authentication uses SCRAM. Provisioning creates a root user (root in the admin database) and, optionally, application users.
In managed operation, ayedo installs the operator and the replica set. Once the operator is in your cluster, you can declare additional replica sets as MongoDBCommunity resources in your namespace. A production replica set has three members; environments without high availability can run a single member.
After handover, you should:
- create a dedicated user per application with the minimum roles on the database it needs, instead of using the root user,
- change the initial passwords and manage credentials as Secrets or in OpenBao.
Connecting
The operator creates Services and user Secrets for the replica set. The connection URI lives in the Secret of the user you connect as. Always configure your application with that replica-set URI (not a single pod), so the driver can locate the current primary on its own. Enable retryWrites=true.
For administrative checks from your workstation, use kubectl port-forward to the replica set Service (see Access & Identity).
High Availability
Writes always go to the primary. You can spread reads across secondaries using the driver's read preference. If the primary fails or restarts during maintenance, the replica set elects a new primary automatically. Writes are unavailable for a few seconds during the election, so enable retryWrites=true and use realistic timeouts. In managed operation, ayedo applies replica-set configuration changes.
Monitoring
When metrics export is enabled, the replica set exposes Prometheus metrics that VictoriaMetrics collects. In Grafana, watch connections, replica-set state, replication lag, and volume usage.
Valkey
Provisioning
Valkey is a Redis-compatible in-memory key-value store for caches, sessions, and queues (block ayedo/k8s/valkey). It runs as a single pod (valkey-master) with a persistent volume and stores data in an append-only file (AOF). Password authentication is enabled. For pure caches, you can set a memory limit (maxmemory) with an eviction policy such as allkeys-lru; by default, Valkey does not evict keys (noeviction).
Connecting
| Parameter | Value |
|---|---|
| Host | valkey-master.<namespace>.svc.cluster.local |
| Port | 6379 |
| Password | Secret valkey-auth, key password |
env:
- name: VALKEY_PASSWORD
valueFrom:
secretKeyRef:
name: valkey-auth
key: password
- name: VALKEY_URL
value: "redis://valkey-master.acme-prod.svc.cluster.local:6379"
Any Redis-compatible client works. For a quick check, run kubectl -n <namespace> exec valkey-master-0 -c valkey -- valkey-cli ping.
High Availability
Valkey runs without replication. During a restart or node failure the service is briefly unavailable; after restarting, Valkey reloads its data from the AOF. Design your application to tolerate short outages (reconnects, treating cache misses as normal). If you need higher availability, discuss it with ayedo before ordering.
Monitoring
Optionally, a redis_exporter sidecar (port 9121) is enabled and VictoriaMetrics collects its metrics. Watch memory usage, connections, hit rate, and evicted keys.
ClickHouse
Provisioning
ClickHouse is a columnar database for analytics over large data sets such as events, usage data, or logs (block ayedo/k8s/clickhouse). It is deployed from the official clickhouse/clickhouse-server image (LTS release) with one database, one user, and a persistent volume. There is no default password: it is set during provisioning or taken from an existing Secret. For transactional workloads, use PostgreSQL instead.
Connecting
| Parameter | Value |
|---|---|
| Host | <instance-name>.<namespace>.svc.cluster.local |
| HTTP interface | port 8123 |
| Native interface | port 9000 |
| Password | the instance's Secret, key password |
# Quick check via the HTTP interface (locally through a port-forward)
kubectl -n <namespace> port-forward svc/<instance-name> 8123:8123
curl -u "<user>:<password>" "http://localhost:8123/?query=SELECT%20version()"
High Availability
By default, ClickHouse runs as a single instance without replication and is briefly unavailable during restarts. Replicated or sharded setups require ClickHouse Keeper and Replicated* tables; agree on partitioning, replication, and resources with ayedo before ordering.
Monitoring
Metrics scraping is not part of the default configuration. Container resources, volume usage, and logs are available in Grafana like for any other workload. Analyze running and slow queries with the system tables, such as system.query_log and system.processes.
Elasticsearch
Provisioning
Elasticsearch is operated with the Elastic Cloud on Kubernetes (ECK) operator (block ayedo/k8s/eck-operator), which manages clusters through the Elasticsearch custom resource. In managed operation, ayedo creates the cluster for you; once the operator is installed in your cluster, you can also declare the resource yourself in your namespace:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: acme-search
namespace: acme-prod
spec:
version: <elasticsearch-version>
nodeSets:
- name: default
count: 3
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 50Gi
Check its state with kubectl get elasticsearch -n acme-prod (column HEALTH).
Connecting
| Parameter | Value |
|---|---|
| Endpoint | https://<name>-es-http.<namespace>.svc.cluster.local:9200 |
| User | elastic (superuser) |
| Password | Secret <name>-es-elastic-user, key elastic |
| CA certificate | Secret <name>-es-http-certs-public, key ca.crt |
ECK enables TLS with a self-signed certificate. Configure the CA certificate in your client rather than disabling certificate verification. Create dedicated users or API keys for applications, with roles limited to the indices they need, instead of using the elastic user.
High Availability
You set the number of nodes with nodeSets[].count. A fault-tolerant cluster needs at least three master-eligible nodes. Your indices also need replica shards (number_of_replicas ≥ 1) so that no data is missing when a node fails. ECK applies version upgrades and configuration changes as rolling updates and creates a Pod Disruption Budget for them.
Monitoring
Metrics scraping is not part of the default configuration. Check cluster state with kubectl get elasticsearch or the _cluster/health and _cat/indices APIs. Container resources, volume usage, and logs are available in Grafana like for any other workload. Watch shard sizes, heap usage, and query latency before adjusting resources.
Further Reading
- Backup & Restore: backing up and restoring PostgreSQL, MongoDB, volumes, and namespaces
- Storage: StorageClasses, volumes, and S3 buckets
- Observability: metrics, logs, and alerts in Grafana
- Service Annex to the Terms and Conditions: binding backup and operations services