Storkctl create custom ApplicationBackup and ApplicationRestores using resourceTypes flag, Portworx.

Audience
Public
Product
Portworx
Content Type
Source Type
Knowledge Base

Storkctl create custom ApplicationBackup and ApplicationRestores using resourceTypes flag, Portworx.

KB0016284
Pure Product
Portworx
Resolution

We support from Stork 23.8.0 onwards the flag resourceTypes

 

Reminder, how to download Storkctl tool:

 

STORK_POD=$(kubectl get pods -l name=stork -n kube-system -o jsonpath='{.items[0].metadata.name}')

# for macos 
kubectl cp $STORK_POD:/storkctl/darwin/storkctl ./storkctl --namespace kube-system --retries=20

# for linux
kubectl cp $STORK_POD:/storkctl/linux/storkctl ./storkctl --namespace kube-system --retries=20

# for windows
kubectl cp $STORK_POD:/storkctl/windows/storkctl.exe ./storkctl.exe --namespace kube-system --retries=20

 

Create the ApplicationBackup object using Storkctl tool.

 

bin/linux/storkctl create applicationbackups


bin/linux/storkctl create backup -h
Start an applicationBackup

Usage:
  storkctl create applicationbackups [flags]

Aliases:
  applicationbackups, applicationbackup, backup, backups

Flags:
  -b, --backupLocation string   BackupLocation to use for the backup
  -h, --help                    help for applicationbackups
      --namespaces strings      Comma separated list of namespaces to backup
      --postExecRule string     Rule to run after executing applicationbackup
      --preExecRule string      Rule to run before executing applicationbackup
      --resourceTypes string    List of specific resource types which need to be backed up, ex: "Deployment,PersistentVolumeClaim"
      --wait                    Wait for applicationbackup to complete




bin/linux/storkctl create backup back4-1 --resourceTypes "Deployment,PersistentVolumeClaim,mongodbcommunity" --namespaces mongodb -n kube-system -b bl1
ApplicationBackup back4-1 started successfully

 

Restore using storkctl tool:

 

bin/linux/storkctl create applicationrestores


bin/linux/storkctl create applicationrestores -h
Start an applicationRestore

Usage:
  storkctl create applicationrestores [flags]

Aliases:
  applicationrestores, applicationrestore, apprestore, apprestores

Flags:
  -l, --backupLocation string   BackupLocation to use for the restore
  -b, --backupName string       Backup to restore from
  -h, --help                    help for applicationrestores
  -r, --replacePolicy string    Policy to use if resources being restored already exist (Retain or Delete). (default "Retain")
      --resources string        Specific resources for restoring, should be given in format "<kind>/<namespace>/<name>,<kind>/<namespace>/<name>,<kind>/<name>", ex: "<Deployment>/<ns1>/<dep1>,<PersistentVolumeClaim>/<ns1>/<pvc1>,<ClusterRole>/<clusterrole1>"
      --wait                    Wait for applicationrestore to complete


bin/linux/storkctl create applicationrestores restore4-2 -l bl1 -b back4-1 -r Delete --resources "PersistentVolumeClaim/mongodb/data-volume-example-mongodb-0,PersistentVolumeClaim/mongodb/data-volume-example-mongodb-1,PersistentVolumeClaim/mongodb/data-volume-example-mongodb-2,MongoDBCommunity/mongodb/example-mongodb" -n kube-system
ApplicationRestore restore4-2 started successfully


bin/linux/storkctl create applicationrestores restore4-3
-l bl1 -b back4-1 -r Delete --resources "PersistentVolumeClaim/mongodb/data-volume-example-mongodb-0" -n kube-system
ApplicationRestore restore4-3 started successfully