Overview
MongoDB is a document-oriented NoSQL database for flexible, schema-free data. This template deploys one MongoDB 8 instance (mongo:8.2.3) on a persistent volume, reachable from other workloads in your GVC and optionally from the internet through a direct load balancer, with optional scheduled mongodump backups to AWS S3 or GCS.
Database credentials are not template values. MongoDB reads its username, password and database name from a dictionary secret you create before installing, so no password passes through Helm or lands in the release.
What Gets Created
Prerequisites
One secret must exist before you install. It holds the credentials your applications put in their connection strings. Secrets are org-level, so no GVC flag is involved.Create the database credentials secret
username, password and database. On first boot MongoDB creates the user in the admin database with the root role; the database entry is the name your applications use in their connection strings (MongoDB creates it on first write):config.credentialsSecretName to this name. Secret names are org-wide, so give each release its own.Read the secret back later
-o yaml. A bare cpln secret reveal prints only a summary table, not the values:Installation
Create the prerequisite secret, then install with the name of that secret:UI
CLI
Terraform
Pulumi
Configuration
Each block below is the shipped default for that part ofvalues.yaml.
Image and Resources
Credentials
cpln://secret/... references, so the values appear in neither the Helm release nor the stored workload spec.
Storage
Internal Access
internalAccess can take a few minutes to take effect; re-test rather than trusting the first response.
Direct Load Balancer
true, MongoDB is exposed on the internet on TCP port 27017 through a direct load balancer with a public IP per location. Only enable it with a strong password in place, and prefer internalAccess for applications running in the same GVC.
Backup
Connecting
admin database, so connection strings must carry authSource=admin:
mongosh from your own machine without opening the firewall, forward the port and connect to 127.0.0.1:
Operations
Backing Up
Whenbackup.enabled is true, the RELEASE_NAME-mongo-backup cron workload runs mongodump on backup.schedule, authenticating with the username and password from your credentials secret. Each run writes one gzip-compressed archive of every database on the instance — not only the one named in your secret — to PREFIX/mongo-YYYY-MM-DDTHH-MM-SSZ.archive.gz in your bucket. Backups do not delete older archives; manage retention with a bucket lifecycle rule.
AWS S3
- Create an S3 bucket. Set
backup.aws.bucketto its name andbackup.aws.regionto its region. - If you do not have a Control Plane Cloud Account for AWS, follow the Create a Cloud Account guide. Set
backup.aws.cloudAccountNameto its name. - Create an IAM policy with the following JSON, replacing
YOUR_BUCKET_NAME, and setbackup.aws.policyNameto its name. The template attaches this policy to the backup identity and nothing else, so the bucket in it is the only storage the job can reach:
- Set
backup.aws.prefixto the folder path for the archives, then setbackup.enabled: trueandbackup.provider: aws.
GCS
- Create a GCS bucket. Set
backup.gcp.bucketto its name. - If you do not have a Control Plane Cloud Account for GCP, follow the Create a Cloud Account guide. Set
backup.gcp.cloudAccountNameto its name. - Add the Storage Admin role to the GCP service account associated with the Cloud Account. The template additionally binds the identity to
roles/storage.objectAdminon exactly the bucket inbackup.gcp.bucket. - Set
backup.gcp.prefixto the folder path for the archives, then setbackup.enabled: trueandbackup.provider: gcp.
[INFO] Backup completed: mongo-....archive.gz:
Restoring a Backup
The archive is amongodump --archive --gzip file, so it is restored with mongorestore --gzip --archive. The mongo:8.2.3 image already contains mongorestore, and the container already holds the credentials in its environment, so the restore runs inside the database container. Raw binary cannot pass through cpln workload exec intact, so the archive is base64-encoded on the way in.
Download the archive
gsutil cp gs://... instead:Copy it into the MongoDB container
--stdin is required; without it the piped data is discarded and the file lands empty:ls -l /tmp/restore.archive.gz reports the same size as your download before continuing.Restore
mongorestore adds the archive’s documents to the existing collections and keeps any document whose _id already exists. Add --drop to replace each collection with the backup’s contents, or --nsInclude to restore a single database or collection; see the mongorestore reference for both.Verify
--eval expression with db.adminCommand({ listDatabases: 1 }), then spot-check a collection count.Rotating the Password
The password in the secret is only read on first boot, so a rotation happens inside MongoDB first and the secret is updated to match:Change it inside MongoDB
Update the secret
password entry of your dictionary secret to the new value, so that applications reading the secret and the backup job authenticate with it.Redeploy the workload
Upgrading from Earlier Versions
Template version 1.4.0 removedconfig.username and config.password as values: credentials became the prerequisite secret described above. Version 1.4.1 narrows the AWS backup permissions. Both upgrade in place; neither changes the data on the volume.
From 1.3.2 or earlier
Read the credentials the database already uses
Create the prerequisite secret with those same values
Remove the old keys from your values
config.username, config.password and config.database, and set config.credentialsSecretName to your secret’s name.Upgrade, then rotate the password
From 1.4.0 with AWS backups
Version 1.4.1 removesaws::ReadOnlyAccess from the backup identity. That AWS managed policy granted read access to every bucket in your AWS account and contained no write actions, so it never carried the backup itself — but it was silently supplying any read action your bucket-scoped policy happened to omit. Before upgrading, make sure your IAM policy contains the full action list under Backing Up; if it already matches, no action is needed. The identity now carries cpln-connector and your bucket-scoped policy only.
Scaling and Availability
The workload is pinned to one replica; raising the replica count is not supported and would produce isolated instances. Scale vertically withresources, and let the volume grow with volumeset.autoscaling. The data volume survives upgrades and restarts, and the template takes a final snapshot (retained 7 days) when the volume set is deleted. For failover and read scaling, use the MongoDB Cluster template.
Troubleshooting
The workload never becomes ready and cpln logs is empty
The workload never becomes ready and cpln logs is empty
cpln helm install reported success, the deployment never reaches ready, and cpln logs returns no lines. cpln workload get-deployments RELEASE_NAME-mongo --gvc GVC_NAME -o yaml shows under status.versions[].message:config.credentialsSecretName names a secret that does not exist (or was created in a different org).Fix: Create the secret as shown in Prerequisites, then run cpln workload force-redeployment RELEASE_NAME-mongo --gvc GVC_NAME or wait several minutes for the deployment to recover on its own.MongoServerError: Authentication failed after changing the secret
MongoServerError: Authentication failed after changing the secret
MongoServerError: Authentication failed.Cause: The secret is applied only when the data directory is first initialized. Editing it later changes what clients present, not the user stored in the database.Fix: Authenticate with the credentials the database was created with, then follow Rotating the Password to bring the database and the secret back in line. Also check that the connection string carries authSource=admin.helm upgrade fails with config.username and config.password were REMOVED
helm upgrade fails with config.username and config.password were REMOVED
cpln helm upgrade exits with the render error quoted under Upgrading from Earlier Versions and nothing is changed.Cause: Your values file still sets config.username or config.password, which 1.4.0 rejects.Fix: Create the prerequisite secret with the existing credentials, delete the two keys, set config.credentialsSecretName, and upgrade again.Backup run fails with AccessDenied on the S3 upload
Backup run fails with AccessDenied on the S3 upload
mongodump finishing, then An error occurred (AccessDenied) when calling the PutObject operation.Cause: The IAM policy named in backup.aws.policyName is missing an action, or its Resource does not match backup.aws.bucket. From 1.4.1 nothing else on the identity fills the gap.Fix: Update the policy to the full action list under Backing Up with both the bucket ARN and BUCKET/*, then wait for the next scheduled run and check its logs.Important Notes
- Create the credentials secret before installing. A missing secret wedges the deployment with no log output; the only diagnostic is
status.versions[].messagefromcpln workload get-deployments. - Do not scale above one replica. More replicas are isolated instances, not a replica set — use MongoDB Cluster for that.
- Credentials apply only on first boot. Changing the secret later does not change the database; rotate inside MongoDB first, then update the secret and redeploy.
- Connection strings need
authSource=admin. The user is created in theadmindatabase, not in the database named in your secret. - Backups are full-instance dumps written on a schedule with no retention policy of their own; use a bucket lifecycle rule to expire old archives.
- Uninstalling deletes the volume set. A final snapshot is taken and retained for 7 days; the release’s data is otherwise gone with it.
- Firewall changes are not instant. Allow a few minutes after changing
internalAccessordirectLoadBalancerbefore concluding a knob is broken.