Scheduled snapshots in OCP GCP
Prerequisites
Configuring cloud secrets
To create cloud snapshots, one needs to setup secrets with Portworx which will get used to connect and authenticate with the configured cloud provider.
Follow instructions on the create and configure credentials section to setup secrets.
Storkctl
Always use the latest storkctl binary tool by downloading it from the current running Stork container.
Perform the following steps to download storkctl from the Stork pod:
-
Linux:
STORK_POD=$(oc get pods -n <namespace> -l name=stork -o jsonpath='{.items[0].metadata.name}') &&
oc cp -n <px-namespace> $STORK_POD:/storkctl/linux/storkctl ./storkctl
sudo mv storkctl /usr/local/bin &&
sudo chmod +x /usr/local/bin/storkctl -
OS X:
STORK_POD=$(oc get pods -n <namespace> -l name=stork -o jsonpath='{.items[0].metadata.name}') &&
oc cp -n <px-namespace> $STORK_POD:/storkctl/darwin/storkctl ./storkctl
sudo mv storkctl /usr/local/bin &&
sudo chmod +x /usr/local/bin/storkctl -
Windows:
-
Copy
storkctl.exefrom the stork pod:STORK_POD=$(oc get pods -n <px-namespace> -l name=stork -o jsonpath='{.items[0].metadata.name}') &&
oc cp -n <px-namespace> $STORK_POD:/storkctl/windows/storkctl.exe ./storkctl.exe -
Move
storkctl.exeto a directory in your PATH.
-
Create a schedule policy
You can use a schedule policy to specify when Portworx should trigger a specific action.
-
Create a file named
daily-policy.yaml, specifying the following fields and values:-
apiVersion: with the version of the Stork scheduler (this example uses
stork.libopenstorage.org/v1alpha1) -
kind: with the
SchedulePolicyvalue -
metadata.name: with the name of the
SchedulePolicyobject (this example usesdaily) -
policy.daily.time: with the backup time (this example uses "10:14PM")
-
policy.retain: with the number of backups Portworx must retain (this example retains 3 backups)
apiVersion: stork.libopenstorage.org/v1alpha1
kind: SchedulePolicy
metadata:
name: daily
policy:
daily:
time: "10:14PM"
retain: 3
For more details about how you can configure aschedule policy, see the Schedule Policy reference page.
-
-
Apply the spec:
oc apply -f daily-policy.yamlschedulepolicy.stork.libopenstorage.org/daily created -
You can check the status of your schedule policy by entering the
storkctl get schedulepolicycommand:storkctl get schedulepolicyNAME INTERVAL-MINUTES DAILY WEEKLY MONTHLY
daily N/A 10:14PM N/A N/A