Docs Menu
Docs Home
/ /
MongoDB Atlas Kubernetes Operator

Back Up Your Atlas Cluster

On this page

  • Considerations
  • Limitations
  • Prerequisites
  • Procedure
  • Create the backup policy.
  • Create the backup schedule.
  • Apply the backup schedule to the cluster.

Note

This feature is not available for any of the following deployments:

  • M0 clusters

  • M2/M5 clusters

  • Flex clusters

Note

Serverless instances back up automatically

Atlas automatically enables backups for Serverless instances and takes snapshots every six hours. Any Atlas Kubernetes Operator backup custom resources you apply to a Serverless instance will not override the automatic settings.

To learn more about backups for Serverless instances, see Serverless Instance Backups.

Atlas Kubernetes Operator supports cloud backup for your Atlas clusters. Cloud backup uses the native snapshot capabilities of your cloud provider to support full-copy snapshots and localized snapshot storage.

To manage cloud backup with Atlas Kubernetes Operator, you can specify and update the following custom resources:

Custom Resource
Purpose

AtlasBackupPolicy Custom Resource

Defines the backup policy, including the frequency of backups and the length of snapshot retention.

Defines the backup schedule, including the time of day that Atlas backs up your database deployment, the number of days back in time to which you can restore, and the backup policy.

Defines the characteristics of a cluster. You must set the spec.backupRef.name field to the name of the configured backup schedule to enable cloud backup for the cluster.

Additionally, to configure continuous backup, you must set spec.deploymentSpec.pitEnabled to true.

Each time you change any of the supported custom resources, Atlas Kubernetes Operator creates or updates the corresponding Atlas configuration.

Review the following considerations:

  • You can specify one backup policy per backup schedule.

  • You can specify one backup schedule per cluster, but you can use the same backup schedule for multiple clusters.

  • Atlas determines the order of nodes to snapshot based on your cluster configuration. To learn more, see Cloud Backups.

  • Atlas Kubernetes Operator supports automatic snapshot distribution. You can configure this with the spec.copySetting field in the AtlasBackupSchedule Custom Resource.

Note

If you have a Backup Compliance Policy enabled, you can't modify the backup policy for an individual cluster below the minimum requirements set in the Backup Compliance Policy. You can modify the cluster-level backup policy at any time. Atlas augments any preexisting cluster-level policies to meet the minimum requirements of the Backup Compliance Policy. All new clusters use the Backup Compliance Policy. If you reduce the frequency of a backup schedule, the change applies only to future backups. Any existing oplog remains for the original window. The minimum requirements of the Backup Compliance Policy apply. You can configure extra snapshot retention. You can also view backup details for all M10+ dedicated clusters including deleted clusters with retained snapshots. To learn more, see View Backup Details for Dedicated Clusters.

Certain limitations apply to cloud backup. To learn more, see Back Up Your Cluster.

To enable cloud backup for your Atlas Kubernetes Operator-managed cluster, you must:

  • Have a running Kubernetes cluster with Atlas Kubernetes Operator deployed.

  • Ensure your IP address is in the organization's API access list.

Follow these steps to enable cloud backup for your Atlas Kubernetes Operator-managed clusters:

1

To learn more about the parameters for a backup policy, see AtlasBackupPolicy Custom Resource.

Example:

cat <<EOF | kubectl apply -f -
apiVersion: atlas.mongodb.com/v1
kind: AtlasBackupPolicy
metadata:
name: "atlas-default-backuppolicy"
spec:
items:
frequencyType: "weekly"
frequencyInterval: 1
retentionUnit: "days"
retentionValue: 7
EOF
2

In the spec.policy.name field, specify the metadata.name from the AtlasBackupPolicy Custom Resource to apply your backup policy.

To learn more about the other parameters for a backup schedule see AtlasBackupSchedule Custom Resource.

Example:

cat <<EOF | kubectl apply -f -
apiVersion: atlas.mongodb.com/v1
kind: AtlasBackupSchedule
metadata:
name: "atlas-default-backupschedule"
spec:
autoExportEnabled: true
copySettings:
- cloudProvider: AWS
frequencies:
- HOURLY
regionName: US_EAST_1
shouldCopyOplogs: true
referenceHourOfDay: 10
referenceMinuteOfHour: 10
restoreWindowDays: 2
policy:
name: atlas-default-backuppolicy
namespace: mongodb-atlas-system
EOF
3

In the spec.backupRef.name field of the AtlasDeployment Custom Resource, specify the metadata.name from the AtlasBackupSchedule Custom Resource to apply your backup schedule to the cluster.

Example:

cat <<EOF | kubectl apply -f -
apiVersion: atlas.mongodb.com/v1
kind: AtlasDeployment
metadata:
name: my-atlas-cluster
spec:
backupRef:
name: atlas-default-backupschedule
namespace: mongodb-atlas-system
EOF

Back

Atlas Stream Processing