Creating a MongoDB Database

This page covers the configuration specific to MongoDB — its Database Mode and any engine-specific settings shown below. The rest of the creation flow — opening the wizard, namespace and name, version, machine profile, storage, and optional features — is the same for every engine and is documented in Common Steps.

Database Mode

Select the topology under Database Mode. Three modes are available:

  • Standalone — A single-node database without high availability or sharding. Best for development or low-traffic workloads.
  • Replicated Cluster — A MongoDB ReplicaSet for high availability.
  • Sharded Cluster — A fully sharded MongoDB cluster for high performance and high availability.

Replicated Cluster

When Replicated Cluster is selected, two additional fields appear:

Replicated Cluster mode selected showing Replicaset Name (rs0) and Replicaset Number (3) fields

FieldDescription
Replicaset NameThe name for the replica set (e.g., rs0). Required.
Replicaset NumberThe number of replica members (e.g., 3). Required.
mongodb+srv style DNSToggle on to advertise externally reachable per-pod endpoints so clients can connect with a mongodb+srv connection string. Available only for Replicated Cluster mode, and only when the database has TLS and gateway exposure enabled — see mongodb+srv Style DNS.

Sharded Cluster

When Sharded Cluster is selected, three subsections appear — Shard Nodes, Config Server, and Mongos — each configurable independently.

Sharded Cluster mode selected showing Shard Nodes, Config Server, and Mongos collapsible panels

Shard Nodes — Configure how MongoDB data is partitioned, replicated, and resourced across your cluster.

Shard Nodes panel showing Shards, Replicaset Number, Storage size, Machine, CPU, and Memory fields

FieldDescription
ShardsNumber of shard partitions (e.g., 2). Required.
Replicaset NumberNumber of replicas per shard (e.g., 3). Required.
Storage sizeDisk size per shard node (e.g., 2Gi). Required.
MachinePreset machine profile or custom for manual CPU/memory.
CPUCPU request per shard node (e.g., 900m).
MemoryMemory request per shard node (e.g., 1Gi).

Config Server — Stores metadata about the sharded cluster including chunk distribution and shard configuration. Must run as a replica set.

Config Server panel showing Replicaset Number, Storage size, Machine, CPU, and Memory fields

FieldDescription
Replicaset NumberNumber of config server replicas (e.g., 3). Required.
Storage sizeDisk size per config server node (e.g., 2Gi). Required.
MachinePreset machine profile or custom.
CPUCPU request (e.g., 800m).
MemoryMemory request (e.g., 1Gi).

Mongos — Acts as the query router for the sharded cluster, directing client requests to the appropriate shards based on metadata from Config Servers.

Mongos panel showing Replicaset number, Machine, CPU, and Memory fields

FieldDescription
Replicaset numberNumber of Mongos router instances (e.g., 2). Required.
MachinePreset machine profile or custom.
CPUCPU request (e.g., 500m).
MemoryMemory request (e.g., 1Gi).

mongodb+srv Style DNS (Replicated Cluster Only)

What this is for. A mongodb+srv:// connection string lets a client discover every replica set member from a single DNS SRV record instead of listing each host. To make that work from outside the cluster, every member must advertise an externally reachable address (this is MongoDB’s horizon mechanism). The mongodb+srv style DNS toggle on the Replicated Cluster form configures those per-pod addresses.

This applies only when you intend to reach a Replicated Cluster MongoDB from outside Kubernetes with a mongodb+srv connection string. If you only connect from within the cluster, use Standalone/Sharded Cluster mode, or connect with a standard mongodb:// string, leave it off.

Prerequisites — the toggle only takes effect when both are enabled (see Additional Options):

  • TLS on the database (upstream TLS). MongoDB requires TLS for SRV-based horizon connections.
  • Expose via Gateway, so the members are reachable from outside the cluster.

Turn on mongodb+srv style DNS to reveal the endpoints panel:

mongodb+srv style DNS toggle with SRV DNS Endpoints inputs

FieldDescription
SRV DNS EndpointsOne entry per replica set member, in pod order (member 0, member 1, …). Each entry is the externally reachable endpoint that pod should advertise. The number of entries must match the Replicaset Number set above. Use + Add new to add an entry.

The endpoints you enter must resolve to the externally reachable address of the exposed database and must be covered by the TLS certificate’s SANs.

DNS records you must create

The mongodb+srv:// scheme is pure DNS discovery — the platform advertises the endpoints, but you must create the matching records in your DNS zone (for a replica set rs0 on domain example.com):

RecordExampleWhy it’s needed
A / CNAME — one per membermongo-0.example.com → <endpoint> (repeat for each member)Each SRV DNS Endpoint you entered must resolve to the member’s externally reachable address. Use A for a fixed IP, CNAME to alias a managed hostname.
SRV — one per member, same name_mongodb._tcp.example.com IN SRV 0 0 <port> mongo-0.example.com.This is what the driver queries first: connecting to mongodb+srv://example.com returns all members (host + port) so the client discovers the full replica set from one name.
TXT — one, same nameexample.com IN TXT "replicaSet=rs0&authSource=admin"The SRV scheme requires a TXT record alongside the SRV to carry options that don’t fit in SRV fields; the driver auto-appends replicaSet/authSource so the app never hardcodes them.

Verify before relying on it: dig SRV _mongodb._tcp.example.com and dig TXT example.com.

Additional MongoDB Options

FieldDescription
ArbiterToggle on to add an arbiter member (votes in elections but stores no data). Configure its pod resources.
Hidden NodeToggle on to add hidden replica members (replicate data but are invisible to clients). Set Replicas, resources, and storage.
HostName / IPOptional host name and IP used to build the connection string and certificate SANs.

Create a MongoDB Database

  1. Open the wizard and select MongoDB — see Getting Started and Select a Database Type.
  2. Set the namespace and name.
  3. Pick the database version and the Database Mode described above, then set the machine profile and storage — see Configure the Database. For Replicated Cluster mode, configure mongodb+srv style DNS if you’ll connect with a mongodb+srv string from outside the cluster.
  4. Optionally configure Advanced Configuration (labels, deletion policy, credentials, point-in-time recovery) and Additional Options (monitoring, backup, TLS, gateway).
  5. Click Deploy.