Implementing Application-Consistent Backups for Kubernetes

Updated

On this page

Applies to: On-premises access nodes only

To implement application-consistent backups for Kubernetes, you can use pre-process and post-process script files on your access nodes.

Commvault supplies and supports pre- and post-execution scripts for the following:

  • MySQL

  • PostgreSQL

  • MongoDB

  • Cassandra

Pre-scripts and post-scripts are script files that run before or after certain job phases. During backups, the script files are copied and executed inside the application pods.

The pre-scripts and post-scripts can be written in any scripting language, such as bash, Perl, or Python. To use Python scripts, you must pre-install Python in the pod.

Important: Commvault does not log the return codes of pre- and post-scripts on the access node. For the location of pre- and post-script output on your containerized application pod, refer to per-application implementations.

Procedure

  1. In the software_installation_directory, create a folder named kscripts/cluster_name as follows, where cluster_name is the name of the cluster, as specified in the Command Center:

    • On a Linux access node, create the folder in the Base directory.

    • On a Windows access node, create the folder in the ContentStore\Base folder.

      Note: Pre-scripts and post-scripts fail if the Kubernetes cluster name (DisplayName) is renamed in Commvault.

  2. To execute the scripts for applications, create files in the folder kscripts\cluster_name with the following naming convention:

    • namespace.application_name.prescript

    • namespace.application_name.postscript

      where application_name is the name of the discovered application.

      To execute the scripts for all namespaces that have the specific application, use the following naming convention:

    • $.application_name.prescript

    • $.application_name.postscript

      where application_name is the name of the discovered application.