Kubernetes Annotations

CommunityEnterprise

This feature allows you to define what volumes (PVC Data) to back up, where and what commands to execute, and how to react to some failures to achieve the best results from data volume backup functionality. You can select which volumes mounted in a Pod you want to backup, select the preferred backup mode for the Pod and PVC, and specify commands to run.

The annotation feature allows administrators of a Kubernetes Cluster, or any Kubernetes cluster user with enough permissions, to configure a persistent volume to be included in the backup.

The supported annotations are:

bacula/backup.mode:[snapshot|clone|standard]

defines how to handle PVC Data backups. If not defined, the default is snapshot.

Note

This annotation is supported on both Pods and PVCs. This type of backup follows the flow described here.

bacula/backup.volumes:<pvcname[,pvcname2…]>

defines which volumes are backed up from this Pod. Multiple PVC names may be selected as a comma-separated list. This annotation is required if you want to back up volumes from this Pod. Any other annotations are optional.

bacula/run.before.job.container.command:<container>/<command>

defines the command to execute in the specific container of the Pod before the volume cloning (or snapshot) and before the Pod’s data backup starts. An asterisk (*) as <container> name means to execute <command> on all containers.

bacula/run.before.job.failjobonerror:[yes|no]

defines whether to fail the job when the exit code of the executed command is not zero. The default is yes.

bacula/run.after.job.container.command:<container>/<command>

defines the command to execute in the specific container of the Pod after volume cloning(or snapshot) and after the Pod’s data backup completes. An asterisk (*) as <container> name means to execute <command> on all containers.

bacula/run.after.job.failjobonerror:[yes|no]

defines whether to fail the job when exit code of the executed command is not zero. The default is no.

bacula/run.after.snapshot.container.command:<container>/<command>

defines the command to execute in the specific container of the Pod after volume cloning (or snapshot) and just before any data backup starts. An asterisk (*) as <container> name means to execute <command> on all containers. Note that the snapshot mode does not perform a volume snapshot but a volume clone.

bacula/run.after.snapshot.failjobonerror:[yes|no]

defines whether to fail the job when exit code of the executed command is not zero. The default is no.

Annotations are an extension to the current PVC Data backup feature available with the pvcdata=… plugin parameter as described in Estimate and Backup Plugin Parameters. This is an independent function which may be used together with the functionality described above, especially since both use the same data archive stream handling with Bacula Backup Pod.

To use this feature, configure the annotations on the selected Pods and ensure that backup for the required Kubernetes namespace is properly configured. No changes to the plugin configuration are required.

Note

Even if the PVC is not listed in the parameter pvcdata, the backup will always be performed if the pod has pod annotations for PVC backup.

Read more:

See also

Previous articles:

Go back to: Persistent Volume Claim Backup.