- Create a new namespace for the backup system - Implement a cron job for scheduled backups - Add a daemon set to handle backup tasks across nodes - Introduce necessary service accounts, roles, and role bindings - Include environment variable handling and configuration via secrets and config maps - Ensure triggering and execution workflow for backups is efficient This commit establishes a new backup system that utilizes both a cron job and a daemon set to automate backups. It organizes the configurations and credentials needed for S3-compatible storage, allowing for seamless backup management across the specified nodes in the Kubernetes cluster.
44 lines
892 B
YAML
44 lines
892 B
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: backup-config
|
|
namespace: backup-system
|
|
data:
|
|
subpath: "nodes"
|
|
backups-to-keep: "3"
|
|
use-https: "True"
|
|
signature-v2: "False" # 设置为 "True" 如果 S3 服务需要 V2 签名
|
|
---
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: backup-service-account
|
|
namespace: backup-system
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: backup-role
|
|
namespace: backup-system
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["get", "list"]
|
|
- apiGroups: [""]
|
|
resources: ["pods/exec"]
|
|
verbs: ["create"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: backup-role-binding
|
|
namespace: backup-system
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: backup-service-account
|
|
namespace: backup-system
|
|
roleRef:
|
|
kind: Role
|
|
name: backup-role
|
|
apiGroup: rbac.authorization.k8s.io
|