KubeBlocks
BlogsEnterprise
⌘K
​
Blogs
Open Source · Production-Grade · CNCF Landscape

KubeBlocks MongoDB Operator for Kubernetes

Deploy production-grade MongoDB clusters in minutes. ReplicaSet HA, sharding, backup & restore, and full Day-2 operations — all via a unified Kubernetes API.

Get Started Free →Read the Docs

0

RPO (w:majority)

< 30s

Failover RTO

100%

Open Source

Deploy MongoDB in 3 steps

1

Install KubeBlocks

# Add Helm repo
helm repo add kubeblocks https://apecloud.github.io/helm-charts
helm repo update

# Install KubeBlocks
helm install kubeblocks kubeblocks/kubeblocks \
  --namespace kb-system --create-namespace
2

Create a ReplicaSet Cluster

apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
  name: mongodb-cluster
  namespace: demo
spec:
  terminationPolicy: Delete
  clusterDef: mongodb
  topology: replicaset
  componentSpecs:
    - name: mongodb
      replicas: 3
3

Cluster is Ready

kubectl get cluster mongodb-cluster -n demo

NAME              CLUSTER-DEFINITION  STATUS   AGE
mongodb-cluster   mongodb             Running  2m

Trusted by Engineering Teams at Scale

BONC CloudBONC Cloud
China Mobile CloudChina Mobile Cloud
China Telecom CloudChina Telecom Cloud
TencentTencent
XiaomiXiaomi
Ping AnPing An
VIP.comVIP.com
KwaiKwai
Tiger BrokersTiger Brokers
CITIC SecuritiesCITIC Securities
SealOSSealOS
FastGPTFastGPT
KubeSphereKubeSphere
MomentaMomenta
360360
TilaaTilaa
OlaresOlares
Changan AutomobileChangan Automobile
State GridState Grid
BONC CloudBONC Cloud
China Mobile CloudChina Mobile Cloud
China Telecom CloudChina Telecom Cloud
TencentTencent
XiaomiXiaomi
Ping AnPing An
VIP.comVIP.com
KwaiKwai
Tiger BrokersTiger Brokers
CITIC SecuritiesCITIC Securities
SealOSSealOS
FastGPTFastGPT
KubeSphereKubeSphere
MomentaMomenta
360360
TilaaTilaa
OlaresOlares
Changan AutomobileChangan Automobile
State GridState Grid
MongoDB Topologies

Every MongoDB Topology. One Operator.

From a 3-node ReplicaSet to a sharded cluster — choose the topology that fits your workload.

One primary handles all writes while one or more secondaries replicate via the oplog. On primary failure, the remaining nodes hold an election — the member with the most up-to-date oplog and a majority of votes is promoted. Failover typically completes within 10–30 seconds.

✓

Majority-vote election — no external coordinator required

✓

Automatic promotion of the most up-to-date secondary

✓

Read scale-out via secondary endpoints

✓

Writes route via a role-aware ClusterIP service

✓

w:majority write concern for stronger durability of acknowledged writes

Automatic Failover
Majority Election
Read Scale-out
Application / Client
Read/Write  mongo-cluster-mongodb-mongodb:27017
Read-Only    mongo-cluster-mongodb-mongodb-ro:27017
RW → roleSelector: primary
RO → roleSelector: secondary
Kubernetes Services
mongo-cluster-mongodb-mongodb
ClusterIP · :27017
selector: kubeblocks.io/role=primary
Endpoints auto-switch with primary
ReadWrite
mongo-cluster-mongodb-mongodb-ro
ClusterIP · :27017
selector: kubeblocks.io/role=secondary
Distribute reads across replicas
ReadOnly
→ primary pod
→ secondary pods
Pods · Worker Nodes
mongodb-0PRIMARY
🍃
mongodb (mongod + Replica Set)
:27017 mongo · primary status
primary
📊
mongodb-exporter
:9216 metrics
⚙ init-syncer (copies syncerctl → /tools)
💾 PVC data-0 · 20Gi
mongodb-1SECONDARY
🍃
mongodb (mongod + Replica Set)
:27017 mongo · secondary status
secondary
📊
mongodb-exporter
:9216 metrics
⚙ init-syncer (copies syncerctl → /tools)
💾 PVC data-1 · 20Gi
mongodb-2SECONDARY
🍃
mongodb (mongod + Replica Set)
:27017 mongo · secondary status
secondary
📊
mongodb-exporter
:9216 metrics
⚙ init-syncer (copies syncerctl → /tools)
💾 PVC data-2 · 20Gi
↔Replica Set Oplog Replicationprimary-0 → secondary-1 · secondary-2  |  w:majority write concern
🔗Headless service — stable pod DNS for internal use (replication, HA heartbeat, operator probes); not a client endpoint
Primary / RW Traffic
Secondary / RO Traffic
Replica Set DCS
Persistent Storage
Comparison

How KubeBlocks Compares to Other MongoDB Solutions

FeatureKubeBlocksPercona OperatorMongoDB Community Operator
Open Source✓✓✓
ReplicaSet HA✓✓✓
Sharding✓✓✓
TLS encryption✓✓✓
TLS rotation✓✓~
Backup (physical)✓✓✗
Scheduled backup✓✓✗
Restore from backup✓✓✗
PITR (oplog streaming)✓✓✗
Horizontal scaling✓✓✓
Vertical scaling✓✓✓
Volume expansion✓✓✓
Dynamic config✓✓~
Prometheus metrics✓✓✗
Minor Upgrade✓✓~
Major Upgrade
Enterprise

Via blue-green deployment

~✗
Cross-cluster DR (standby)Enterprise✗✗
Bootstrap from external MongoDBEnterprise✗✗
User & role managementEnterprise✓✓
Web management UIEnterprise✗✗

✓ = Supported · ~ = Partial / Limited · ✗ = Not supported

Enterpriseindicates a capability available in KubeBlocks Enterprise, not the open-source distribution. Contact us for licensing →

Based on publicly available documentation. Features may vary by version.

Capabilities

Built for Production MongoDB

Backup, failover, scaling, and configuration — describe the desired state in YAML; KubeBlocks reconciles MongoDB for your chosen topology.

Backup & PITR
KubeBlocks takes scheduled full backups on a secondary and continuously archives the oplog to object storage. Restore to any second within the retention window — not just snapshot points.
PITR · Minute-level RPO
Full Backup + Continuous Oplog Coverage
Full Backup
00:00
Full Backup
06:00
Full Backup
12:00
PITR Restore
16:23
Oplog archived continuously (every ~5 min) — restore to any point between full backups
1. Restore Full BackupLoad nearest snapshot from object storage onto a secondary
→
2. Replay OplogApply archived oplog entries up to the exact target timestamp
→
3. Cluster ReadyNew replica set is consistent at the chosen point in time
✓ PITR · Minute-level RPO
Day-2 Operations

Every Operation Declared as a Kubernetes Resource

No SSH into pods, no shell scripts. Submit an OpsRequest and KubeBlocks handles the rest.

High Availability & Scaling

✓

Horizontal Scaling

Add or remove replica set members online — KubeBlocks handles topology reconfiguration automatically.

✓

Vertical Scaling

Resize CPU and memory on running instances with a rolling strategy.

✓

Volume Expansion

Expand PVC storage without pod restarts on supported storage classes.

✓

Rolling Restart

Controlled pod restarts with minimal disruption to active connections.

✓

Planned Primary Stepdown

Trigger a graceful rs.stepDown() on demand to promote a specific secondary.

✓

Stop / Start

Suspend clusters to eliminate compute cost; resume with full state restored.

Configuration, Security & Observability

✓

Dynamic Configuration

Tune mongod parameters via OpsRequest — changes applied without restart where supported.

✓

TLS Encryption

Enable, rotate, or disable in-flight encryption without downtime.

✓

Custom Users & Roles

Declarative user and role management via Kubernetes Secrets — synced across all replica set members.

✓

Password Management

Rotate credentials stored in Kubernetes Secrets with automatic propagation.

✓

Version Upgrade

Rolling upgrades across MongoDB minor versions; major version upgrades with blue-green deployment are available in KubeBlocks Enterprise.

✓

Prometheus Metrics

Per-instance metrics via mongodb-exporter, with pre-built Grafana dashboards.

From the Blog

Go Deeper on MongoDB on Kubernetes

Managing Over 6,000 Self-Hosted Databases Without a DBA

Managing Over 6,000 Self-Hosted Databases Without a DBA

How Sealos used KubeBlocks to manage 6,000+ self-hosted databases across four availability zones — architecture, HA, backup, and operations.

How Containerization Affects Database Performance: runC, Kata, and gVisor

How Containerization Affects Database Performance: runC, Kata, and gVisor

CPU, memory, and I/O benchmarks across container runtimes — and how to avoid common pitfalls like I/O hangs and OOM errors in Kubernetes.

Running Databases on Kubernetes — Insights from Leading Chinese Internet Companies

Running Databases on Kubernetes — Insights from Leading Chinese Internet Companies

Why major internet companies are moving databases to Kubernetes, and what it takes to operate them reliably at scale.

Get Started

Get Started with KubeBlocks MongoDB Operator, Risk-Free.

Open source and production-ready. Enterprise customers get dedicated onboarding, migration support, and SLA-backed support.

Get Started Free →Talk to the Team
✓Open Source
✓MongoDB & 35+ other engines
✓Production-grade HA
✓No vendor lock-in

© 2026 KUBEBLOCKS INC