To implement application-consistent backups for Kubernetes, you can use pre-process and post-process script files on your access nodes.
For application consistency to work, the required CSI drivers must be installed and PVCs must be created using a supported CSI.
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
-
Backup jobs depend on the return codes of pre- and post-scripts. Any return code value other than 0 fails backup jobs. For the location of pre- and post-script output on your containerized application pod, refer to per-application implementations.
-
Pre-scripts and post-scripts are not supported on live volume backup.
Before You Begin
For this method to work, you must implement both a pre-execution script and a post-execution script. If you use only a pre-execution script, the script is not executed.
Procedure
-
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.
-
-
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.
-