AtlasBackupSchedule
Custom Resource
On this page
The AtlasBackupSchedule
custom resource configures a backup
schedule that you can apply to your
AtlasDeployment
Custom Resource. When you
create the AtlasBackupSchedule
custom
resource, Atlas Kubernetes Operator tries to create or update a backup schedule.
Important
Custom Resources No Longer Delete Objects by Default
Atlas Kubernetes Operator uses custom resource configuration files to manage your Atlas configuration, but as of Atlas Kubernetes Operator 2.0, custom resources you delete in Kubernetes are no longer (by default) deleted in Atlas. Instead, Atlas Kubernetes Operator simply stops managing those resources in Atlas. For example, if you delete an
AtlasProject
Custom Resource in Kubernetes, by default the Atlas Kubernetes Operator no longer automatically deletes the corresponding project from Atlas. This change in behavior is intended to help prevent accidental or unexpected deletions. To learn more, including how to revert this behavior to the default used prior to Atlas Kubernetes Operator 2.0, see New Default: Deletion Protection in Atlas Kubernetes Operator 2.0.Similarly, Atlas Kubernetes Operator does not delete teams from Atlas if you remove them from an Atlas project in Kubernetes with the Atlas Kubernetes Operator.
Explicitly define your desired configuration details in order to avoid implicitly using default Atlas configuration values. In some cases, inheriting Atlas defaults may result in a reconciliation loop which can prevent your custom resource from achieving a
READY
state. For example, explicitly defining your desired autoscaling behavior in yourAtlasDeployment
custom resource, as shown in the included example, ensures that a static instance size in your custom resource is not being repeatedly applied to an Atlas deployment which has autoscaling enabled.autoScaling: diskGB: enabled: true compute: enabled: true scaleDownEnabled: true minInstanceSize: M30 maxInstanceSize: M40
Atlas Kubernetes Operator does one of the following actions using the Atlas Cloud Backup Schedule API Resource:
Creates a new backup schedule.
Updates an existing backup schedule.
If you remove the AtlasBackupSchedule
resource from your Kubernetes
cluster, Atlas stops creating backups for your cluster.
Note
You must do all of the following to back up a cluster:
Create a backup policy
Create a backup schedule and set the
spec.policy.name
field to the name of the configured backup policy.Set the
spec.backupRef.name
field in theAtlasDeployment
Custom Resource to the name of the configured backup schedule.
To learn more, see Back Up Your Atlas Cluster.
You can specify one backup schedule per cluster, but you can use the same backup schedule for multiple clusters.
Example
The following example shows an AtlasBackupSchedule
custom resource
configured to take snapshots at 10:10 UTC and restore up to two days:
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
Parameters
This section describes some of the key AtlasBackupSchedule
custom
resource parameters available. For a full list of parameters available,
see the Atlas Modify Cloud Backup Backup Policy
API. Refer
to these descriptions, the available examples, and the API
documentation to customize your specifications.
spec.autoExportEnabled
Type: boolean
Optional
Flag that specifies whether Atlas automatically exports cloud backup snapshots to your AWS backup. Specify
true
to enable automatic export of cloud backup snapshots to the AWS bucket. Specifyfalse
to disable automatic export.
spec.copySetting
Type: array
Required
List that contains a document for each copy setting item in the desired backup policy. Each copy setting item defines a snapshot distribution policy.
spec.export.exportBucketId
Type: string
Optional
Unique 24-hexadecimal character string that identifies the AWS bucket.
spec.export.frequencyType
Type: string
Optional
Human-readable label that indicates the rate at which the export policy item occurs.
spec.referenceHourOfDay
Type: number
Optional
Number that indicates the UTC hour of day between
0
and23
, inclusive, representing the hour of the day that Atlas takes snapshots for backup policy items.
spec.referenceMinuteOfHour
Type: number
Optional
Number that indicates the minutes after
spec.referenceHourOfDay
that Atlas takes snapshots for backup policy items. Value must be between0
59
inclusive.
spec.restoreWindowDays
Type: number
Optional
Number that indicates the days back in time that you can restore to with continuous cloud backup accuracy. Value must be a positive, non-zero integer.
This setting applies to continuous cloud backups only.
spec.policy
Type: array
Required
List that contains the details for the backup policy to apply.
spec.policy.name
Type: string
Required
metadata.name
value within thheAtlasBackupPolicy
Custom Resource for the backup policy that you want to apply. You can specify only one backup policy per backup schedule. You can't use the same backup policy in multiple backup schedules.
spec.policy.namespace
Type: string
Required
String that indicates the namespace that contains the
AtlasBackupPolicy
Custom Resource for the backup policy that you want to apply.