CWDBCluster resource. Use it to tune topology, compute, storage, extensions, affinity, and the initial database name and owner.
For the creation workflow, see Create a database. For day-2 actions like editing, resizing, and deleting a database, see Manage database. For the CWDBBackup field reference and the spec.postgres.restore field reference, see Manage backups.
By default, your CoreWeave Database (CWDB) only has password authentication. For the modes CWDB supports and how to configure clients, see Authentication modes.
data.coreweave.com/v1 API group and are namespaced.
Minimal manifest
The smallestCWDBCluster manifest the operator accepts:
Topology
spec.postgres.instances controls how many PostgreSQL instances the operator runs. The operator places one primary and all replicas across distinct nodes through pod anti-affinity, assuming the CoreWeave Kubernetes Service (CKS) cluster has enough nodes to spread out on.
The following table describes the instances field:
For most workloads, 3 instances is the right balance of availability and cost. Scaling beyond 3 instances primarily adds read capacity, not durability. Set
spec.postgres.instances to 5 or more when your workload is read-heavy and benefits from spreading reads across additional replicas.
Compute
spec.resources sets the CPU and memory requests and limits for each instance in the database. The following example configures every instance with 2 CPU requested, 4 GiB of memory, and an 8 GiB memory limit:
spec.resources field:
Replica scale-out (increasing or decreasing
spec.postgres.instances after creation) is supported in limited availability. In-place vertical scaling (changing per-instance CPU or memory) hasn’t been verified yet. To change per-instance compute, restore the database into a new one with the desired sizing. See Manage database and Manage backups.
Storage
spec.storage configures the per-instance persistent volume on DFS. The following example requests 50 GiB of storage for each instance:
A 3-instance database with
storage: 50Gi provisions 150 GiB of DFS in total (each instance has its own replicated volume). Storage cost is billed as standard DFS usage. Start small and grow as data grows.
Extensions
CWDB supports pgvector, letting you use the database as a vector database and to perform approximate nearest-neighbor search. Enable it by adding it to thespec.postgres.extensions list:
After the database is
Ready, install the extension per database with CREATE EXTENSION vector;.
Affinity overrides
spec.affinity overrides the default Kubernetes affinity rules for the database. By default, every database carries node-affinity rules that prefer CPU nodes and pod anti-affinity rules that spread instances across distinct nodes. The following example hard-requires CPU nodes rather than preferring them:
Database name and owner
spec.postgres.dbName and spec.postgres.owner set the initial database name and owner role. By default, CWDB creates a database named app with an owner role named app. The following example names the database orders and the owner role orders_app:
The operator creates two credentials Secrets per database, named after
dbName: [CLUSTER-NAME]-[DBNAME]-credentials for read-write traffic and [CLUSTER-NAME]-[DBNAME]-credentials-ro for read-only traffic to replicas. For dbName: orders, those are [CLUSTER-NAME]-orders-credentials and [CLUSTER-NAME]-orders-credentials-ro. The defaults for dbName: app are [CLUSTER-NAME]-app-credentials and [CLUSTER-NAME]-app-credentials-ro.
A built-in postgres superuser role is always created alongside the owner role. The postgres role is reserved for break-glass access and database maintenance. Use the owner role for application traffic.
Complete example
A 3-instance database sized for a moderate application workload, with a custom database name andpgvector enabled:
Database status
The operator manages thestatus section of a CWDBCluster. To inspect it, run the following command from a terminal with kubectl access to your CKS cluster:
status section reports the following information:
For the
CWDBBackup field reference and the spec.postgres.restore field reference, see Manage backups.