diff --git a/velero/README.md b/velero/README.md deleted file mode 100644 index ff97ab4..0000000 --- a/velero/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Velero + MinIO (c2et.net) - -Este paquete contiene: -- `namespace.yaml` -- Secrets de credenciales (`cloud-credentials-site-a`, `cloud-credentials-site-b`) -- BackupStorageLocation (BSL) por YAML: `default` (site-a) y `site-b` -- Ejemplo de `Schedule` (nightly a las 02:00 y 02:30) -- Dos `values.yaml` de Helm: - - `helm/values-approach-a.yaml`: crea BSL por defecto y Secret desde Helm - - `helm/values-approach-b.yaml`: sin BSL/Secret; los aplicas tú en YAML (GitOps) -- `ServiceMonitor` (si usas Prometheus Operator) -- Dashboard de Grafana (JSON) - -## Flujo recomendado (GitOps, Approach B) -```bash -# 1) Instala Velero por Helm sin BSL ni secrets -helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts -helm upgrade --install velero vmware-tanzu/velero -n velero --create-namespace -f helm/values-approach-b.yaml - -# 2) Aplica Secrets, BSLs y Schedules -kubectl apply -f namespace.yaml -kubectl apply -f secrets/secret-site-a.yaml -f secrets/secret-site-b.yaml -kubectl apply -f bsl/bsl-default-site-a.yaml -f bsl/bsl-site-b.yaml -kubectl apply -f schedules/schedules.yaml -``` - -## Notas -- MinIO requiere `s3ForcePathStyle=true`. -- Si usas CA propia, añade `spec.config.caCert` en los BSL. -- `ServiceMonitor` requiere Prometheus Operator; ajusta `metadata.labels.release` al valor que use tu Prometheus. -- Importa el dashboard JSON en Grafana (datasource `prometheus`). - diff --git a/velero/helm/values-approach-b.yaml b/velero/helm/values-approach-b.yaml index 330f4bc..6bc6b3c 100644 --- a/velero/helm/values-approach-b.yaml +++ b/velero/helm/values-approach-b.yaml @@ -1,10 +1,13 @@ +# values-combined.yaml credentials: - useSecret: false # Secrets y BSLs los aplicas tú por YAML + useSecret: false # Secrets y BSLs los aplicas tú por YAML (como ya hiciste) configuration: - features: EnableCSI - backupStorageLocation: [] # ninguno desde Helm + features: "" + backupStorageLocation: [] # ninguno desde Helm (los gestionas por YAML) + defaultVolumesToFsBackup: true # copia datos de PV vía node-agent/Kopia al BSL +# Dejamos SOLO el plugin de AWS; el CSI externo se quita (viene integrado en Velero 1.16) initContainers: - name: velero-plugin-for-aws image: velero/velero-plugin-for-aws:v1.9.0 @@ -12,12 +15,16 @@ initContainers: volumeMounts: - name: plugins mountPath: /target - - name: velero-plugin-for-csi - image: velero/velero-plugin-for-csi:v0.7.0 - imagePullPolicy: IfNotPresent - volumeMounts: - - name: plugins - mountPath: /target +# **activar** el node-agent (DaemonSet) y darle tolerations "catch-all" +deployNodeAgent: true nodeAgent: - enabled: true + podConfig: + tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + - operator: "Exists" # tolera cualquier otro taint diff --git a/velero/readme.md b/velero/readme.md new file mode 100644 index 0000000..a8c6ee6 --- /dev/null +++ b/velero/readme.md @@ -0,0 +1,86 @@ +# Velero + MinIO (c2et.net) + +Este paquete contiene: +- `namespace.yaml` +- Secrets de credenciales (`cloud-credentials-site-a`, `cloud-credentials-site-b`) +- BackupStorageLocation (BSL) por YAML: `default` (site-a) y `site-b` +- Ejemplo de `Schedule` (nightly a las 02:00 y 02:30) +- `helm/values-approach-b.yaml`: despliegue de Velero sin BSL/Secret (GitOps) +- `ServiceMonitor` (si usas Prometheus Operator) +- Dashboard de Grafana (JSON) + +## Flujo recomendado (GitOps, Approach B) +```bash +# 1) Instala Velero por Helm sin BSL ni secrets +helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts +helm upgrade --install velero vmware-tanzu/velero -n velero --create-namespace -f helm/values-approach-b.yaml + +# 2) Aplica Secrets, BSLs y Schedules +kubectl apply -f namespace.yaml +kubectl apply -f secrets/secret-site-a.yaml -f secrets/secret-site-b.yaml +kubectl apply -f bsl/bsl-default-site-a.yaml -f bsl/bsl-site-b.yaml +kubectl apply -f schedules/schedules.yaml +``` + +## Cliente Velero +Para interactuar con Velero necesitas el binario en tu máquina de administración. + +```bash +# Linux AMD64 +wget https://github.com/vmware-tanzu/velero/releases/download/v1.16.2/velero-v1.16.2-linux-amd64.tar.gz +tar -xvf velero-v1.16.2-linux-amd64.tar.gz +sudo mv velero-v1.16.2-linux-amd64/velero /usr/local/bin/ + +# MacOS Intel +wget https://github.com/vmware-tanzu/velero/releases/download/v1.16.2/velero-v1.16.2-darwin-amd64.tar.gz +tar -xvf velero-v1.16.2-darwin-amd64.tar.gz +sudo mv velero-v1.16.2-darwin-amd64/velero /usr/local/bin/ +``` + +Verifica la instalación: +```bash +velero version +``` + +## Hacer un backup manual +Ejemplo: respaldar el namespace `wireguard`. +```bash +velero backup create wireguard-backup --include-namespaces wireguard --wait +velero backup describe wireguard-backup --details +``` + +Puedes excluir recursos innecesarios (ej. CRDs de KubeVirt): +```bash +velero backup create smoke --include-namespaces default --exclude-resources uploadtokenrequests.upload.cdi.kubevirt.io --wait +``` + +## Programar backups (Schedules) +Ejemplo de programación diaria a las 03:15, TTL de 30 días: +```bash +velero schedule create daily-wireguard --schedule "15 3 * * *" --include-namespaces wireguard --ttl 720h --default-volumes-to-fs-backup +``` + +Los schedules también se pueden definir por YAML en `schedules/schedules.yaml`. + +## Restaurar un backup +### Restaurar al mismo namespace (desastre real) +```bash +# 1) Borrar el namespace roto +kubectl delete ns wireguard + +# 2) Restaurar desde el backup +velero restore create wireguard-restore --from-backup wireguard-backup --wait +velero restore describe wireguard-restore --details +``` + +### Restaurar a otro namespace (ensayo) +```bash +kubectl create ns wireguard-restore +velero restore create wireguard-restore-test --from-backup wireguard-backup --namespace-mappings wireguard:wireguard-restore --wait +``` + +## Notas +- MinIO requiere `s3ForcePathStyle=true`. +- Si usas CA propia, añade `spec.config.caCert` en los BSL. +- `ServiceMonitor` requiere Prometheus Operator; ajusta `metadata.labels.release` al valor que use tu Prometheus. +- Importa el dashboard JSON en Grafana (datasource `prometheus`). diff --git a/velero/vsl-default.yaml b/velero/vsl-default.yaml new file mode 100644 index 0000000..90b81f6 --- /dev/null +++ b/velero/vsl-default.yaml @@ -0,0 +1,7 @@ +apiVersion: velero.io/v1 +kind: VolumeSnapshotLocation +metadata: + name: default + namespace: velero +spec: + provider: velero.io/csi