Very simple backup tool for Kubernetes that scales down a workload (Deployment/StatefulSet/ReplicaSet), creates an archive of the specified directory, uploads it to S3 and scales the workload back up.
Environment variable | Type | Description |
---|---|---|
RESOURCE_ID | string | Resource identifer in form of TYPE/NAME, where TYPE is deployment(s), statefulset(s) or replicaset(s). |
RESOURCE_NAMESPACE | string | Namespace where workload resides. |
RESOURCE_WAIT | boolean | Wait for pods to terminate if true. |
BACKUP_DIRECTORY | string | Directory to backup. |
S3_ENDPOINT | string | S3 endpoint address (domain or ip address). |
S3_REGION | string | S3 region (can be empty). |
S3_ACCESS_KEY_ID | string | S3 access key id. |
S3_SECRET_ACCESS_KEY | string | S3 secret access key. |
S3_BUCKET | string | S3 bucket. |
S3_STORAGE_CLASS | string | S3 storage class (can be empty). |
S3_UNSECURE | boolean | Do not use SSL if true. |
S3_ARCHIVE_LIFETIME | string | Lifetime of the archive in the bucket (can be empty). Supports d units. |
TELEGRAM_BOT_TOKEN | string | Telegram bot token from @BotFather .If not empty, notifications will be sent by this bot. |
TELEGRAM_CHAT_ID | integer | Telegram chat id where notifications should be sent. |
This tool only does get
and patch
requests on <TYPE>/scale
,
so a rule like this for scaling deployments will suffice:
apiGroups:
- apps
resources:
- deployments/scale
verbs:
- get
- patch
However, if RESOURCE_WAIT
is set,
this tool also does list
requests on apps/replicasets
and pods
.
Therefore, you will also need these rules:
- apiGroups:
- apps
resources:
- replicasets
verbs:
- list
- apiGroups:
- ""
resources:
- pods
verbs:
- list