Adding Application-Consistent Protection for Kubernetes

Updated

For Kubernetes, to achieve application-consistent protection, you must use both pre-process and post-process script files. You can use pre-scripts and post-scripts on both Windows and Linux access nodes.

Pre-scripts and post-scripts are script files that run before or after certain job phases. The pre-scripts and post-scripts can be written in any scripting language such as bash, Perl, Python, and so on. The script files are copied and executed inside a pod. To use Python scripts, you must pre-install Python in the pod.

Procedure

  1. In the software_installation_directory, create a folder named kscripts as follows:

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

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

  2. Name the scripts according to what you want to execute them for:

    • To execute the scripts for applications, use 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.

Examples

Bash Script File

Pre-process script for MySQL:

# cat /opt/Commvault/Base/kscripts/mydatabase.myapplication.prescript

mysql -h host_name -p password -P port_number -u user_name

flush tables with read lock;

Post-process script for MySQL:

# cat /opt/Commvault/Base/kscripts/mydatabase.myapplication.postscript

unlock tables;

exit;

Absolute Path to the Bash Script File in the Pod

Pre-process script for MySQL:

cat /opt/Commvault/Base/kscripts/mydatabase.myapplication.prescript

/myscripts/quiesce-mysql.sh #Absolute path to file inside pod

Post-process script for MySQL:

cat /opt/Commvault/Base/kscripts/mydatabase.myapplication.postscript

/myscripts/unquiesce-mysql.sh #Absolute path to file inside pod

Absolute Path to the Python Script File In the Pod

Pre-process script for MySQL:

cat /opt/Commvault/Base/kscripts/mydatabase.myapplication.prescript

python /myscripts/quiesce-mysql.py #Absolute path to file inside pod

Post-process script for MySQL:

cat /opt/Commvault/Base/kscripts/mydatabase.myapplication.postscript

python /myscripts/unquiesce-mysql.py #Absolute path to file inside pod