Let's perform the following steps to take a backup of our application:
- If you have an application and persistent volumes associated with the backup labeled already, you can skip to Step 5. Otherwise, create a namespace and a PVC using the following example code:
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: backup-example
labels:
app: app2backup
EOF
- Create a PVC in the backup-example namespace:
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc2backup
namespace: backup-example
labels:
app: app2backup
spec:
accessModes:
- ReadWriteOnce
storageClassName: openebs-cstor-default
resources:
requests:
storage: 4Gi
EOF
- Create a pod that will use the PVC and write to the /data/out.txt file inside the pod using the sample myapp.yaml manifest under the src/chapter6/kasten directory:
$ kubectl apply -f - kasten/myapp.yaml
- Verify that our myapp pod writes data to the volume:
$ kubectl exec -it myapp cat /data/out.txt -nbackup-example
Thu Sep 12 23:18:08 UTC 2019
- On the Kasten Dashboard, click on Unmanaged applications:
- In the backup-example namespace, click on Create a policy:
- Enter a name and select the Snapshot action:
- Select Daily as the Action Frequency:
- Click on Create Policy:
By following these steps, you will have created your first backup using the policy, as well as a schedule for the following backup jobs.