echo $(POD_NAME) > /source/data/data.txt & sleep 3000 env:ĪpiVersion: v1 fieldPath: metadata.name image: busybox imagePullPolicy: IfNotPresent name: busybox resources: $ kubectl get pod -n demo stash-demo-0 -o yaml apiVersion: v1 kind: Pod metadata:Īpp: stash-demo controller-revision-hash: stash-demo-6d887c7b6f /pod-name: stash-demo-0 name: stash-demo-0 namespace: demo. If you view the resource definition of this pod, you will see that there is a container named stash which is running run-backup command. Let’s check that the sidecar has been injected successfully, $ kubectl get pod -n demo If everything goes well, Stash will inject a sidecar container into the stash-demo StatefulSet to take backup of /source/data directory. docs/examples/guides/latest/workloads/statefulset/backupconfiguration.yamlī/ss-backup created Let’s create the BackupConfiguration crd we have shown above, $ kubectl apply -f.
This section will show you how to use Stash to backup volumes of a StatefulSet. Note: YAML files used in this tutorial are stored in docs/examples/guides/latest/workloads directory of stashed/docs repository. To keep everything isolated, we are going to use a separate namespace called demo throughout this tutorial. You should be familiar with the following Stash concepts: Install Stash in your cluster following the steps here. If you do not already have a cluster, you can create one by using Minikube. Before You BeginĪt first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. This guide will show you how to use Stash to backup and restore volumes of a StatefulSet. Backup and Restore Volumes of a StatefulSet