|
| 1 | +# Velero Backup Configuration |
| 2 | + |
| 3 | +## Overview |
| 4 | +Velero provides backup and disaster recovery for Kubernetes clusters using OpenStack Swift for object storage and vSphere CSI for volume snapshots. |
| 5 | + |
| 6 | +## Key Configuration Choices |
| 7 | + |
| 8 | +### Storage Backend |
| 9 | +```yaml |
| 10 | +backupStorageLocation: |
| 11 | + - name: iad3-flex-dei7343-a9256 |
| 12 | + provider: community.openstack.org/openstack |
| 13 | + bucket: k8s-dr-velero |
| 14 | +``` |
| 15 | +**Why**: Uses OpenStack Swift via the community plugin for backup metadata storage. |
| 16 | +
|
| 17 | +**Note**: Initially attempted to use the AWS S3 plugin with Swift's S3-compatible endpoint, but Swift doesn't support AWS chunked uploads (used for large objects). The native OpenStack plugin provides better compatibility with Swift's API. |
| 18 | +
|
| 19 | +### CSI Snapshot Integration |
| 20 | +```yaml |
| 21 | +configuration: |
| 22 | + features: EnableCSI |
| 23 | + defaultSnapshotMoveData: false |
| 24 | + defaultVolumesToFsBackup: false |
| 25 | + volumeSnapshotLoc [] |
| 26 | +``` |
| 27 | +**Why**: |
| 28 | +- `defaulCSI`: Enables CSI snapshot support for volume backups |
| 29 | +- `defaultVolushotMoveData: false`: Uses CSI snapshots instead of file-level backups by default |
| 30 | +- `defaultVolumesToFsBackup: false`: Prevents automatic file-level backups (opt-in only) |
| 31 | +- `volumeSnapshotLocation: []`: Disables legacy VolumeSnapshotLocation (CSI uses VolumeSnapshotClass instead) |
| 32 | + |
| 33 | +### VolumeSnapshotClass |
| 34 | +```yaml |
| 35 | +extraObjects: |
| 36 | + - apiVersion: snapshot.storage.k8s.io/v1 |
| 37 | + kind: VolumeSnapshotClass |
| 38 | + metadata: |
| 39 | + name: velero-vsphere-snapshot-class |
| 40 | + labels: |
| 41 | + velero.io/csi-volumesnapshot-cl "true" |
| 42 | + driver: csi.vspher |
| 43 | + deletionPolicy: Delete |
| 44 | +``` |
| 45 | +**Why**: Defines how Velero creates CSI snapshots. The label `velero.io/csi-volumesnapshot-class: "true"` tells Velero to use this class for backups. |
| 46 | + |
| 47 | +### Credentials |
| 48 | +```yaml |
| 49 | +podEnvFrom: |
| 50 | + - secretRef: |
| 51 | + name: cloud-credentials |
| 52 | +``` |
| 53 | +**Why**: OpenStack plugin requires environment variables (`OS_AUTH_URL`, `OS_APPLICATION_CREDENTIAL_ID`, etc.) for authentication. The secret contains both individual env vars and a `cloud` key for Velero's credential file mount. |
| 54 | + |
| 55 | +### Node Agent |
| 56 | +```yaml |
| 57 | +deployNodeAgent: false |
| 58 | +``` |
| 59 | +**Why**: Currently disabled. Kopia (the file-level backup engine) doesn't support OpenStack Swift backend. Requires further research into: |
| 60 | +- Using S3-compatible Swift endpoint for Kopia |
| 61 | +- Alternative storage backends for file-level backups |
| 62 | +- Hybrid approach with separate storage for file-level vs metadata |
| 63 | + |
| 64 | +CSI snapshots provide sufficient backup coverage for current needs. |
| 65 | + |
| 66 | +## Common Pitfalls |
| 67 | + |
| 68 | +### Kopia Backend Incompatibility |
| 69 | +**Problem**: "invalid backend type community.openstack.org/openstack" errors during file-level backups. |
| 70 | + |
| 71 | +**Solution**: Kopia (used by node-agent) doesn't support OpenStack. Set `defaultVolumesToFsBackup: false` to use CSI snapshots by default. |
| 72 | + |
| 73 | +### Missing Environment Variables |
| 74 | +**Problem**: "Missing input for argument [auth_url]" authentication errors. |
| 75 | + |
| 76 | +**Solution**: The secret must be mounted as environment variables using `podEnvFrom`. Individual `OS_*` keys in the secret are required, not just a clouds.yaml file. |
| 77 | + |
| 78 | +### Swift Temp URL Authentication |
| 79 | +**Problem**: "401 Unauthorized: Temp URL invalid" errors. |
| 80 | + |
| 81 | +**Solution**: Both `OS_SWIFT_TEMP_URL_KEY` and `OS_SWIFT_TEMP_URL_DIGEST` are required in the credentials secret. These must match the temp URL key configured on the Swift container. |
| 82 | + |
| 83 | +```bash |
| 84 | +# Set temp URL key on Swift container (if not already set) |
| 85 | +swift post -m "Temp-URL-Key: <your-key>" |
| 86 | +``` |
| 87 | + |
| 88 | +The `OS_SWIFT_TEMP_URL_KEY` value must match the key set on the container, and `OS_SWIFT_TEMP_URL_DIGEST` specifies the hash algorithm (typically `sha256`). |
| 89 | + |
| 90 | +### VolumeSnapshotLocation Errors |
| 91 | +**Problem**: "spec.provider: Required value" during Helm upgrade. |
| 92 | + |
| 93 | +**Solution**: Set `volumeSnapshotLocation: []` to disable legacy snapshot locations. CSI snapshots use VolumeSnapshotClass instead. |
| 94 | + |
| 95 | +### Pod Security Standards |
| 96 | +**Problem**: node-agent DaemonSet fails with "violates PodSecurity" errors. |
| 97 | + |
| 98 | +**Solution**: Velero namespace requires `privileged` Pod Security Standard for hostPath volumes. |
| 99 | + |
| 100 | +## Required Secrets |
| 101 | + |
| 102 | +### cloud-credentials |
| 103 | +Contains OpenStack authentication credentials. Must include both environment variables and a `cloud` key. |
| 104 | + |
| 105 | +```yaml |
| 106 | +stringData: |
| 107 | + # Environment variables for OpenStack plugin |
| 108 | + OS_AUTH_URL: https://keystone.api.iad3.rackspacecloud.com/v3 |
| 109 | + OS_APPLICATION_CREDENTIAL_ID: <credential-id> |
| 110 | + OS_APPLICATION_CREDENTIAL_SECRET: <credential-secret> |
| 111 | + OS_REGION_NAME: IAD3 |
| 112 | + OS_SWIFT_TEMP_URL_KEY: <temp-url-key> |
| 113 | + OS_SWIFT_TEMP_URL_DIGEST: sha256 |
| 114 | +``` |
| 115 | + |
| 116 | +**Key Fields**: |
| 117 | +- `OS_AUTH_URL`: OpenStack Keystone endpoint (required) |
| 118 | +- `OS_APPLICATION_CREDENTIAL_ID`: Application credential ID (required) |
| 119 | +- `OS_APPLICATION_CREDENTIAL_SECRET`: Application credential secret (required) |
| 120 | +- `OS_REGION_NAME`: OpenStack region (required) |
| 121 | +- `OS_SWIFT_TEMP_URL_KEY`: Temp URL key for Swift authentication (required, must match container setting) |
| 122 | +- `OS_SWIFT_TEMP_URL_DIGEST`: Hash algorithm for temp URLs (required, typically `sha256`) |
| 123 | + |
| 124 | +## Verification |
| 125 | +```bash |
| 126 | +# Check backup storage location |
| 127 | +kubectl get backupstoragelocation -n velero |
| 128 | +
|
| 129 | +# Verify CSI snapshot class |
| 130 | +kubectl get volumesnapshotclass velero-vsphere-snapshot-class |
| 131 | +
|
| 132 | +# Test backup |
| 133 | +velero backup create test --include-namespaces=default |
| 134 | +
|
| 135 | +# Check backup status |
| 136 | +velero backup describe test --details |
| 137 | +
|
| 138 | +# View backup logs |
| 139 | +velero backup logs test |
| 140 | +``` |
| 141 | + |
| 142 | +## Backup Usage |
| 143 | + |
| 144 | +### CSI Snapshot Backup (Current Method) |
| 145 | +```bash |
| 146 | +velero backup create my-backup --include-namespaces=myapp |
| 147 | +``` |
| 148 | + |
| 149 | +### File-Level Backup (Future) |
| 150 | +File-level backups via node-agent are currently disabled and require: |
| 151 | +- Compatible storage backend (Kopia doesn't support OpenStack) |
| 152 | +- Additional testing and validation |
| 153 | +- Possible migration to S3-compatible Swift endpoint or alternative backend |
| 154 | + |
| 155 | +For now, all backups use CSI snapshots exclusively. |
0 commit comments