Ransomware attackers specifically target and attempt to destroy backup systems to increase the probability of payment. Hardening your system is critical. Please ensure you have reviewed your platform security using the Security Hardening Checklist
Cohesity

COHESITY Documentation

Explore our documentation to get started, discover products & new features, access troubleshooting guides, register sources, platforms support.

Products
Data Security Alliance
Visit Cohesity.com
Demos
Support
Blogs
Developers
Partner Portals
Cohesity Community
© 2026 Cohesity, Inc. All Rights Reserved.
Terms of Use|
Privacy Policy|
Legal|
  1. Home
  2. NetBackup™ for Kubernetes Administrator's Guide
  3. About Openshift Virtualization support
  4. Application consistent virtual machines backup
NetBackup™ for Kubernetes Administrator's Guide

Application consistent virtual machines backup

You must annotate the virt-launcher pod with the NetBackup pre and post hooks if it is responsible for spawning virtual machines (VMs), as VMs cannot be created without it.

Commands to freeze and unfreeze the virtual machines:

  • /usr/bin/virt-freezer --freeze --name <vm-name> --namespace <namespace>

  • /usr/bin/virt-freezer --unfreeze --name <vm-name> --namespace <namespace>

# kubectl annotate pod -l vm.kubevirt.io/name=<vm-name> -n <vm-namespace>  netbackup-pre.hook.backup.velero.io/command='["/usr/bin/virt-freezer", "--freeze", "--name", "<vm-name>", "--namespace", "<vm-namespace>"]'

netbackup-pre.hook.backup.velero.io/container=compute 

 netbackup-post.hook.backup.velero.io/command='

["/usr/bin/virt-freezer", "--unfreeze", "--name",

"<vm-name>", "--namespace", "<vm-namespace>"]'

  netbackup-post.hook.backup.velero.io/container=compute

NetBackup supporting Velero Restore Hooks

In NetBackup, when performing a Restore Virtual Machine operation, Velero pre- and post-restore hooks are not executed for KubeVirt-based virtual machines. This limitation arises because KubeVirt dynamically generates launcher pods for virtual machines, and their creation process is decoupled from Velero's restore workflow. As a result, Velero is unable to associate or apply its hooks to these dynamically created pods.

To execute post-restore actions within a KubeVirt virtual machine, users can utilize the cloudInitNoCloud mechanism to inject and run scripts directly inside the guest operating system after the VM is restored.

Warning:

Even though NetBackup supports Velero restore hooks, NetBackup has limitations while using it for KubeVirt based VMs

Note:

In order to achieve app consistency, it is necessary to install qemu-guest-agent on virtual machines to implement kubevirt-specific pre-exec and post-exec rules.

For more details, about configuration of NetBackup pre and post hook, see https://www.veritas.com/

Post restore hook example:

InitContainer Restore Hooks annotations:
init.hook.restore.velero.io/container-image
init.hook.restore.velero.io/container-name
init.hook.restore.velero.io/command

InitContainer Restore Hooks As Pod Annotation Example:
$ kubectl annotate pod -n <POD_NAMESPACE> <POD_NAME> \
    init.hook.restore.velero.io/container-name=restore-hook \
    init.hook.restore.velero.io/container-image=alpine:latest \
    init.hook.restore.velero.io/command='["/bin/ash", "-c", "date"]'
	
	
Exec Restore Hooks annotations:
post.hook.restore.velero.io/container 
post.hook.restore.velero.io/command 
post.hook.restore.velero.io/on-error
post.hook.restore.velero.io/exec-timeout 
post.hook.restore.velero.io/wait-timeout 


Exec Restore Hooks As Pod Annotation Example:
$ kubectl annotate pod -n <POD_NAMESPACE> <POD_NAME> \
    post.hook.restore.velero.io/container=postgres \
    post.hook.restore.velero.io/command='["/bin/bash", "-c", "psql < /backup/backup.sql"]' \
    post.hook.restore.velero.io/wait-timeout=5m \
    post.hook.restore.velero.io/exec-timeout=45s \
    post.hook.restore.velero.io/on-error=Continue

Feedback

Was this page helpful?
Previous

OpenShift Virtualization support

Next

Troubleshooting for virtualization

Feedback

Was this page helpful?