Created
November 5, 2020 16:06
-
-
Save yohanb/f61e3a9225aa1a1a3d786ab417579b30 to your computer and use it in GitHub Desktop.
Kubernetes CronJob for scheduled disk snapshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1beta1 | |
kind: CronJob | |
metadata: | |
name: snapshot-job | |
spec: | |
schedule: "@daily" | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: snapshot | |
image: mcr.microsoft.com/dotnet/core/sdk:3.1 | |
args: | |
- /bin/sh | |
- -c | |
- >- | |
dotnet tool install --tool-path . dotnet-az-snapshot-tool; | |
./az-snapshot-tool run | |
-t xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | |
-s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | |
-g myRg | |
-n myDisk | |
-l 7 | |
env: | |
- name: AZURE_TENANT_ID | |
value: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | |
- name: AZURE_CLIENT_ID | |
value: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | |
- name: AZURE_CLIENT_SECRET | |
valueFrom: | |
secretKeyRef: | |
name: mySecret | |
key: mySecretKey | |
restartPolicy: OnFailure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment