diff --git a/gitops/home-kubernetes/velero/helmrelease.yaml b/gitops/home-kubernetes/velero/helmrelease.yaml new file mode 100644 index 0000000..866f4cd --- /dev/null +++ b/gitops/home-kubernetes/velero/helmrelease.yaml @@ -0,0 +1,141 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: velero + namespace: velero +spec: + interval: 30m + chart: + spec: + chart: velero + version: "11.3.2" # Velero 1.16.x - latest stable as of Jan 2025 + sourceRef: + kind: HelmRepository + name: vmware-tanzu + namespace: flux-system + install: + crds: CreateReplace + remediation: + retries: 3 + upgrade: + crds: CreateReplace + remediation: + retries: 3 + values: + # Node agent for filesystem backups (kopia/restic) + deployNodeAgent: true + nodeAgent: + podVolumePath: /var/lib/kubelet/pods + # nodeAgent.privileged removed in chart 8.x+, use containerSecurityContext instead + containerSecurityContext: + privileged: true + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + memory: 1Gi + + configuration: + # backupStorageLocation - note: provider is at same level as bucket, not nested + backupStorageLocation: + - name: default + provider: aws + bucket: velero-backups # create this bucket in minio first + accessMode: ReadWrite + default: true + config: + region: us-east-1 # minio ignores but required + s3ForcePathStyle: "true" + s3Url: http://192.168.0.2:9000 # adjust to your minio service + + # Volume snapshot location (for CSI snapshots, optional) + volumeSnapshotLocation: + - name: default + provider: aws + config: + region: us-east-1 + + # Use kopia for fs backups (restic deprecated, kopia is default in 1.14+) + uploaderType: kopia + + # Default TTL for backups + defaultBackupTTL: 720h # 30 days + + # Features + defaultVolumesToFsBackup: false # opt-in via annotation per-pod + + # Credentials + credentials: + useSecret: true + existingSecret: velero-minio-credentials + + # Velero server resources + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + memory: 512Mi + + # Schedules + schedules: + daily-all-namespaces: + disabled: false + schedule: "0 3 * * *" # 3 AM daily + useOwnerReferencesInBackup: false + template: + ttl: 168h # 7 days + storageLocation: default + includedNamespaces: + - "*" + excludedNamespaces: + - kube-system + - kube-public + - kube-node-lease + - flux-system + - velero + excludedResources: + - events + - events.events.k8s.io + snapshotVolumes: false + defaultVolumesToFsBackup: true + + weekly-full: + disabled: false + schedule: "0 4 * * 0" # Sunday 4 AM + template: + ttl: 720h # 30 days + storageLocation: default + includedNamespaces: + - "*" + excludedNamespaces: + - kube-system + - kube-public + - kube-node-lease + snapshotVolumes: false + defaultVolumesToFsBackup: true + + # Init containers for plugins - AWS plugin for S3-compatible storage + # Note: CSI plugin merged into velero core in v1.14, no separate initContainer needed + initContainers: + - name: velero-plugin-for-aws + image: velero/velero-plugin-for-aws:v1.11.0 # compatible with Velero 1.15/1.16 + imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /target + name: plugins + + # Metrics + metrics: + enabled: true + serviceMonitor: + enabled: false # set true if using prometheus-operator + additionalLabels: {} + + # Disable volume snapshots if not using CSI snapshotter + snapshotsEnabled: false + + # Pod annotations/labels + podAnnotations: {} + podLabels: {} \ No newline at end of file diff --git a/gitops/home-kubernetes/velero/helmrepository.yaml b/gitops/home-kubernetes/velero/helmrepository.yaml new file mode 100644 index 0000000..eb7eda4 --- /dev/null +++ b/gitops/home-kubernetes/velero/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: vmware-tanzu + namespace: flux-system +spec: + interval: 24h + url: https://vmware-tanzu.github.io/helm-charts \ No newline at end of file diff --git a/gitops/home-kubernetes/velero/namespace.yaml b/gitops/home-kubernetes/velero/namespace.yaml new file mode 100644 index 0000000..ba69c05 --- /dev/null +++ b/gitops/home-kubernetes/velero/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: velero \ No newline at end of file diff --git a/gitops/home-kubernetes/velero/secret-minio.yaml b/gitops/home-kubernetes/velero/secret-minio.yaml new file mode 100644 index 0000000..e24fca1 --- /dev/null +++ b/gitops/home-kubernetes/velero/secret-minio.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: velero-minio-credentials + namespace: velero +stringData: + cloud: | + [default] + aws_access_key_id=k8s + aws_secret_access_key=poh9ieceHohnum5e \ No newline at end of file diff --git a/gitops/home-kubernetes/velero/velero-runbook.md b/gitops/home-kubernetes/velero/velero-runbook.md new file mode 100644 index 0000000..467c772 --- /dev/null +++ b/gitops/home-kubernetes/velero/velero-runbook.md @@ -0,0 +1,625 @@ +# Velero Backup & Recovery Runbook + +## Quick Reference + +| Operation | Command | +|-----------|---------| +| List backups | `velero backup get` | +| Backup status | `velero backup describe --details` | +| Browse backup contents | `velero backup describe --details \| grep -A100 "Resource List"` | +| Restore full namespace | `velero restore create --from-backup --include-namespaces ` | +| Restore single PVC | `velero restore create --from-backup --include-resources pvc,pv --selector app=