Skip to main content

Backup and Restore

This section explains how to back up and restore Virtana Platform data and Kubernetes resources so you can recover from accidental deletion, a failed upgrade, or a cluster failure. All three guides use Velero, but each targets a different environment.

K8s backup and restore on AWS

Uses Velero with an AWS S3 bucket and volume snapshots to back up and restore namespaces in a Kubernetes cluster running on AWS. You can back up an application namespace to S3, then restore it after an accidental deletion or a failed upgrade. See Backup and restore on AWS for details.

OpenShift backup and restore with OADP

Uses the OpenShift API for Data Protection (OADP) operator, OpenShift's Velero-based data protection, to back up and restore workloads on an OpenShift cluster. You can protect an OpenShift project and its persistent volumes so you can recover them after a cluster issue. See OpenShift Backup and Restore with OAPD for details.

K8s cluster backup and restore with Velero

Uses Velero to back up and restore resources on a standard or on-premises Kubernetes cluster, typically with S3-compatible storage such as MinIO. You can back up an on-premises cluster's namespaces to local S3-compatible storage and restore them on the same or a new cluster. See Backup and Restore in a Kubernetes Cluster with Velero for details.

Backup and restore on AWS

Velero is an open-source Kubernetes backup, restore, and disaster recovery tool that captures cluster resources (manifests such as Deployments, Services, ConfigMaps, and Secrets) and, when configured, persistent volume data using CSI/EBS volume snapshots and file-level backups.

In the Virtana Platform, you can deploy Velero in the cluster through the provided Helm-based setup and configure it to store backups in an AWS S3 bucket. You can then use the Velero CLI to create namespace backups and perform restores, so you can recover an application or migrate it to another cluster or environment.

Prerequisites

Before you begin, make sure you have the following prerequisites to confirm readiness and gather required credentials:

  • AWS IAM user with permissions for S3 (bucket read/write/list) and EBS snapshots (create/delete/describe). Have the Access Key ID and Secret Access Key ready.

  • Kubernetes cluster access with permissions to create namespaces and install Helm charts.

  • Install the Velero server through Helm charts.

  • Network access from the cluster to AWS S3 and EC2 APIs for your selected region.

  • Use a dedicated IAM user or role with least-privilege policies scoped to the S3 bucket and snapshot actions needed by Velero.

Velero server installation

To install the Velero server, create a velero-values.yaml file that configures the backup storage location (S3 bucket and region), the snapshot location (EBS snapshot region), the required feature flags (for example, CSI snapshots), and the AWS credentials and plugin settings. Then deploy Velero with the official Helm chart into the velero namespace. Copy the YAML configuration into a file, update the values as described, and then run the Helm install commands.

Create velero-values file

Create a new file named velero-values.yaml with the following contents, and then customize it for your environment.

configuration:
  backupStorageLocation:
  - bucket: velero-example-bucket  
    config:
      region: us-east-2            
    name: default
    provider: aws
  volumeSnapshotLocation:
  - config:
      region: us-east-2          
    name: default
    provider: aws
  features: EnableCSI
credentials:
  extraEnvVars: {}
  secretContents:
    cloud: |
      [default]
      aws_access_key_id=XXXXXXXXXXX     
      aws_secret_access_key=XXXXXXX    
initContainers:
- image: velero/velero-plugin-for-aws:v1.10.0
  imagePullPolicy: IfNotPresent
  name: velero-plugin-for-aws
  volumeMounts:
  - mountPath: /target
    name: plugins
deployNodeAgent: true

The following table defines where Velero stores backup and volume data.

Table 127.

Field

Description

Default value

backupStorageLocation

Defines where object-store backups are stored.

bucket

The name of the S3 bucket used to store backups. Must be changed to your actual bucket name.

velero-example-bucket

config.region

The AWS region where the S3 bucket is located.

us-east-2

name

A logical name for this backup storage location.

default

provider

The cloud provider plugin to use for storage.

aws

volumeSnapshotLocation

Defines where and how volume snapshots are taken.

features

Enables the Container Storage Interface (CSI) snapshot support in Velero.

EnableCSI



The following table defines the AWS credentials Velero uses to access S3 and EC2 APIs.

Table 128.

Field

Description

extraEnvVars

A map for injecting additional environment variables into the Velero pod.

secretContents.cloud

The inline content of the AWS credentials file in INI format. It contains aws_access_key_id and aws_secret_access_key under the [default] profile.



The following table defines the init containers that run before the main Velero container starts, typically used to install provider plugins.

Table 129.

Field

Description

Default value

initContainers.image

The Docker image for the AWS plugin. This plugin enables Velero to interact with AWS services

velero/velero-plugin-for-aws:v1.10.0

imagePullPolicy

Controls when the image is pulled.

IfNotPresent

name

The name of the init container.

velero-plugin-for-aws

volumeMounts.mountPath

The path inside the init container where the plugins volume is mounted.

/target

volumeMounts.name

The name of the shared volume.

plugins

deployNodeAgent

Deploys the Velero Node Agent as a DaemonSet on every node. This enables file-system-level backups for volumes that don't support native snapshots.

true



Deploy Velero server with Helm

Deploys the Velero server-side components into your Kubernetes cluster using the official Velero Helm chart and your customized velero-values.yaml. This step is done to apply the AWS S3/EBS configuration and to create the required resources in the velero namespace.

Run the following commands in a terminal with cluster access:

helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
helm upgrade --install velero vmware-tanzu/velero --namespace velero --create-namespace -f velero-values.yaml

To verify the resources, run the following command:

kubectl -n velero get pods,deploy,ds,cm,secret

The Velero Deployment and the Node Agent DaemonSet should be running, and the logs should show successful initialization of the AWS plugin and storage locations.

Velero Client (CLI) Installation

In this step, you install the Velero command-line tool on your workstation so you can initiate and manage backup or restore operations against the Velero server running in the cluster.

This is done by downloading the appropriate Velero release tarball for your OS, extracting it, and placing the Velero binary into a directory on your PATH, typically /usr/local/bin for Ubuntu or Debian, then validating the installation with velero help. See Install the CLI for detailed instructions for other OS types.

curl -L -o /tmp/velero.tar.gz https://github.com/vmware-tanzu/velero/releases/download/v1.14.0/velero-v1.14.0-linux-amd64.tar.gz 
tar -C /tmp -xvf /tmp/velero.tar.gz
mv /tmp/velero-v1.14.0-linux-amd64/velero /usr/local/bin/velero
chmod +x /usr/local/bin/velero
velero --help

Backup and restore operations

In this section, you can interact by running Velero backup create to capture Kubernetes resources for a target namespace into the configured AWS S3 bucket, and Velero restore create to rehydrate those resources back into the cluster from a selected backup. It also includes the basic commands to check backup or restore status and review logs so you can confirm the operation completed successfully.

Create a backup

Create a backup named nginx-example-bkp for a single namespace. Upon successful completion, backups will be available in the S3 bucket of AWS.

Run the following command to take a backup with Velero:

velero backup create nginx-example-bkp --include-namespaces nginx-example

Restore from a Backup

Restores cluster state from a previously created backup. Confirm target cluster or namespace policies and quotas before restoring.

Run the following command to restore the backup taken with Velero:

velero restore create --from-backup nginx-example-bkp

Restores can overwrite existing resources if names collide. Consider using label selectors, remapping namespaces, or restoring to a clean cluster or namespace when testing.

OpenShift Backup and Restore with OAPD

Red Hat’s OpenShift-native data protection framework deploys and manages Velero to perform consistent backup and restore of Kubernetes resources and persistent volume data. In the Virtana Platform, this enables operators to capture namespace-scoped backups and reliably restore applications, configuration, and storage after accidental deletion, failed upgrades, or cluster or application incidents.

In this setup, MinIO provides an in-cluster, S3-compatible object storage backend where Velero stores backup artifacts (metadata and volume backup data by the node agent), giving users a self-contained backup target without relying on external cloud storage.

Prerequisites

Make sure you have the following prerequisites and update the cluster or tooling where needed before moving on.

  • OpenShift cluster with OADP operator installed.

  • Helm installed for MinIO chart deployment.

  • Need oc/kubectl CLI access.

  • Internet access to pull Helm charts and container images.

  • Pod annotations for each pod in spec.template.metadata.annotations is as follows:

    annotations: backup.velero.io/backup-volumes: "*"

Install MinIO (Object Storage)

It provisions an in-cluster, S3-compatible object store that Velero or OADP uses as the backup target where backup metadata and volume backup data are uploaded. The installation is performed using the MinIO Helm chart. You add the MinIO Helm repository, create a minio-values.yaml file to define the deployment mode, and then run helm upgrade --install to deploy MinIO into a dedicated minio namespace.

On OpenShift, you need to grant the MinIO service account the required Security Context Constraints (SCC) to run successfully. Finally, use the MinIO client (mc) inside the pod to create the Velero bucket and a dedicated Velero user with read/write permissions.

Add Helm repo and update

In this step, you configure your local Helm client to trust and pull charts from the official MinIO Helm chart repository. Run the following command to add the MinIO Helm repository and refresh chart indices.

helm repo add minio https://charts.min.io/
helm repo update

helm repo add registers the MinIO chart repository URL with your local Helm configuration, and helm repo update refreshes Helm’s local chart index so it can discover the latest available chart versions before you install or upgrade MinIO.

Create MinIO values file

The values file lets you customize the MinIO deployment in a repeatable, version-controlled way. Here, it is used to set MinIO to standalone mode, enable persistent storage for backups, specify resource requests, configure service exposure, and control optional components like the MinIO console.

Create a file named minio-values.yaml with the following configuration:

mode: standalone
persistence:
  enabled: true
  size: 50Gi
resources:
  requests:
    memory: 512Mi
    cpu: 250m
rootUser: "minioadmin"
rootPassword: "minioadmin"
service:
  type: ClusterIP
replicas: 1
console:
  enabled: false

The following table provides the details of each field of the above configuration file:

Table 130.

Field

Description

Default value

mode

MinIO deployment mode. standalone runs a single instance.

standalone

persistence.enabled

Ensures data is stored on a PersistentVolume and survives pod restarts.

true

persistence.size

Requested PV capacity for object data.

50Gi

resources.requests.memory/cpu

Minimum guaranteed resources for stable performance.

rootUser/rootPassword

Bootstrap admin credentials for MinIO.

service.type

Exposure method inside the cluster. ClusterIP limits access to in-cluster clients.

ClusterIP

replicas

Number of MinIO pods. 1 for standalone.

1

console.enabled

Enables/disables MinIO Web Console. Disabled here for simplicity and minimal attack surface.

false



Install MinIO

Run the following command to install MinIO in its own namespace using the values file.

helm upgrade --install minio minio/minio \
  -n minio --create-namespace \
  -f minio-values.yaml \
  --version 5.4.0

Assign SCC for OpenShift

In this step, you grant the MinIO workload the Security Context Constraints (SCC) permissions it may need to run correctly on OpenShift. Run the following command to bind the required SCC to the MinIO service account in the minio namespace, then verify who is allowed to use it:

oc adm policy add-scc-to-user anyuid -z minio-sa -n minio
oc adm policy who-can use scc anyuid

Configure Buckets with MinIO client (mc)

This step prepares MinIO so that Velero has a known bucket to store backups and a dedicated set of credentials with the right permissions. Open a terminal inside the MinIO container, configure an mc (MinIO Client) alias to point to the MinIO service endpoint. After establishing the connection, create the required bucket, provision a user, and assign the appropriate access permissions.

kubectl exec -it deploy/minio -n minio -- bash
# Inside pod:
mc alias set localminio http://minio:9000 minioadmin minioadmin
mc mb localminio/velero
mc admin user add localminio velero-user vP@assWoRd
mc admin policy attach localminio readwrite --user velero-user
mc ls localminio

Configure cloud credentials for Velero

Configuring cloud credentials enables Velero to authenticate to the MinIO object storage in order to write backups and read them back during restores. You do this by creating a Kubernetes Secret named cloud-credentials.yaml in the OADP namespace, containing an AWS-style credentials file.

apiVersion: v1
kind: Secret
metadata:
  name: cloud-credentials
  namespace: openshift-adp
stringData:
  cloud: |
    [default]
    aws_access_key_id = velero-user
    aws_secret_access_key = vP@assWoRd

The following table defines each field of the above configuration:

Table 131.

Field

Description

Default value

metadata.name

Secret name referenced by OADP/Velero.

cloud-credentials

metadata.namespace

Must match the OADP operator namespace.

openshift-adp

stringData.cloud

AWS-style credentials file. Values are injected into Velero for S3-compatible access to MinIO. Replace with your secure credentials.



Run the command to apply the secret to the OADP namespace so that OADP/Velero can use these credentials to access the MinIO S3 bucket for backups and restores.

kubectl apply -f cloud-credentials.yaml

Deploy OADP DataProtectionApplication (DPA)

The deployment of the DPA custom resource lets OADP configure Velero with the correct settings. This defines Velero’s configuration, plugins, and backup location.

Create a dpa.yaml file in the OADP namespace with your Velero configuration:

apiVersion: oadp.openshift.io/v1alpha1
kind: DataProtectionApplication
metadata:
  name: velero-dpa
  namespace: openshift-adp
spec:
  configuration:
    nodeAgent:
      enable: true
      uploaderType: kopia
    velero:
      disableFsBackup: false
      defaultPlugins:
        - openshift
        - aws
        - kubevirt
  backupLocations:
    - velero:
        provider: aws
        objectStorage:
          bucket: velero
          prefix: backups
        config:
          region: minio
          s3ForcePathStyle: "true"
          s3Url: http://minio.minio.svc.cluster.local:9000
        credential:
          name: cloud-credentials
          key: cloud
        default: true

The following table defines each field of the above configuration:

Table 132.

Field

Description

Default value

metadata.namespace

OADP operator namespace ensures that the operator can manage this DPA.

openshift-adp

spec.configuration.nodeAgent.enable

When true, deploys a Node Agent DaemonSet on every node to support file-system-level backups of persistent volumes.

true

spec.configuration.nodeAgent.uploaderType

The tool used by the Node Agent to upload PV data.

kopia

spec.configuration.velero.disableFsBackup

When false, allows file-system-based backups of volumes.

false

spec.configuration.velero.defaultPlugins

List of Velero plugins to install automatically.

openshift for OpenShift API integration.

aws for S3-compatible object storage.

kubevirt if backing up KubeVirt VMs.

spec.backupLocations[].velero.provider

The storage provider type.

aws

objectStorage.bucket/prefix

Target bucket and prefix path within MinIO for backup objects.

config.region

Arbitrary region label. Must be non-empty for AWS plugin; using minio.

minio

config.s3ForcePathStyle

When true, uses path-style URLs instead of virtual-hosted-style.

true

config.s3Url

The endpoint URL of the S3-compatible object store.

http://minio.minio.svc.cluster.local:9000

credential.name/key

Reference to the Secret and key holding the AWS-style credentials content.

default

Marks this backup location as the default for Velero operations

true



Run the following command to apply, and then verify that the Velero/OADP pods are running:

kubectl apply -f dpa.yaml
kubectl get pods -n openshift-adp

Create a tuned Backup Storage Location (BSL) (optional)

The Velero configuration uses the information to know where backups are stored (bucket/prefix) and how to connect to that storage. The BSL points Velero to the MinIO S3-compatible service and the velero bucket, so backups and restore artifacts are consistently written to the correct location.

Create a tuned BSL for faster uploads, backup-storage-location.yaml.

apiVersion: velero.io/v1
kind: BackupStorageLocation
metadata:
  name: velero-bsl
  namespace: openshift-adp
spec:
  provider: aws
  objectStorage:
    bucket: velero
    prefix: backups
  config:
    region: minio
    s3ForcePathStyle: 'true'
    s3Url: 'http://minio.minio.svc.cluster.local:9000'
    maxParallel: "10"
    maxRetries: "5"
    maxRetriesBackoff: "2s"
    partSize: "104857600"
  credential:
    name: cloud-credentials
    key: cloud
  default: true

The following table defines each field of the above configuration:

Table 133.

Field

Description

Default value

metadata.namespace

The namespace where Velero is running.

openshift-adp

spec.provider

The storage provider type.

aws

objectStorage.bucket/prefix

Components where backup objects are written within MinIO.

config.region/s3ForcePathStyle/s3Url

The endpoint URL of the S3-compatible object store, pointing to the in-cluster MinIO service.

http://minio.minio.svc.cluster.local:9000

config.maxParallel

The maximum number of parallel upload/download operations Velero performs against this storage location.

10

config.maxRetries

The maximum number of times Velero retries a failed S3 operation before marking it as failed.

5

config.maxRetriesBackoff

The wait duration between retries, using an exponential backoff strategy.

2s

config.partSize

The size of each part in a multipart upload to S3.

104857600

credential.name/key

The name of the Kubernetes Secret that contains the S3 access key and secret key.

default

When true, this location is used as the default destination for all Velero backups unless another location is explicitly specified in the backup command.

true



After applying the backup-storage-location.yaml, you can reference it by name, for example, velero-bsl, in backup specs through the storageLocation to ensure backups use the tuned settings. Run the following command:

kubectl apply -f backup-storage-location.yaml

Create a backup

Creating a backup is the step where you define what data and Kubernetes resources Velero should capture and how the backup should be executed and retained.

Create a backup.yaml, adjust names/namespaces:

apiVersion: velero.io/v1
kind: Backup
metadata:
  name: virtana-io-backup-16sep-01
  namespace: openshift-adp
spec:
  csiSnapshotTimeout: 120m0s
  defaultVolumesToFsBackup: true
  includedNamespaces:
    - virtana-io
  itemOperationTimeout: 10h0m0s
  snapshotMoveData: false
  storageLocation: velero-bsl
  ttl: 72h0m0s

The following table defines each field of the above configuration:

Table 134.

Field

Description

Default value

metadata.namespace

Velero/OADP control namespace where CRDs are reconciled.

openshift-adp

spec.csiSnapshotTimeout

The maximum time Velero waits for a CSI volume snapshot to become ready before marking it as failed.

120m0s

spec.defaultVolumesToFsBackup

When true, all persistent volumes in the included namespaces are backed up using file-system-level backup by default.

true

spec.includedNamespaces

A list of namespaces to include in this backup. Only resources within the specified namespaces are captured.

virtana-io

spec.itemOperationTimeout

Maximum time allowed for long-running backup item operations to complete.

10h0m0s

spec.snapshotMoveData

When false, CSI volume snapshots remain in the source storage location and are not moved or copied to the backup storage location.

false

spec.storageLocation

The name of the BackupStorageLocation resource where backup artifacts are stored.

velero-bsl

spec.ttl

Time to live shares details such as how long this backup is retained before Velero automatically deletes it.

72h0m0s



Run the following command to apply the backup resource to start the Velero backup job, then list backups in the openshift-adp namespace to confirm it was created and to monitor its status.

kubectl apply -f backup.yaml
velero backup get -n openshift-adp`

Restore from backup

In this step, you use Velero through OADP to recreate Kubernetes/OpenShift resources and recover persistent data from a previously completed backup stored in MinIO.

Create a restore.yaml that points to the desired backupName, optionally tunes restore behavior:

apiVersion: velero.io/v1
kind: Restore
metadata:
  name: virtana-io-restore-16sep-01
  namespace: openshift-adp
spec:
  uploaderConfig:
    parallelFilesDownload: 16
  includedNamespaces:
    - virtana-io
  backupName: virtana-io-backup-16sep-01
  restorePVs: true
  restoreVolumes: true
  itemOperationTimeout: 12h

The following table defines each field of the above configuration:

Table 135.

Field

Description

Default value

metadata.namespace

The namespace where Velero is running.

openshift-adp

spec.uploaderConfig.parallelFilesDownload

The number of files downloaded in parallel from the backup storage location during a file-system-level restore.

16

spec.includedNamespaces

A list of namespaces to restore. Only resources belonging to the specified namespaces are recovered from the backup.

virtana-io

spec.backupName

The name of the Backup resource to restore from.

virtana-io-backup-16sep-01

spec.restorePVs

When true, Velero restores PersistentVolume (PV) objects from the backup, re-creating the underlying storage resources.

true

spec.restoreVolumes

When true, Velero restores the actual volume data back into the restored PVCs.

true

spec.restoreVolumes

Maximum time allowed for long-running restore item operations to complete.

12h



Run the following command to apply restore.yaml and monitor progress and confirm completion using the Velero CLI.

kubectl apply -f restore.yaml
velero restore get -n openshift-adp

Validation

In this step, confirm that your Velero/OADP backup and restore actually succeeded at both the Velero control-plane level and at the application level. Validate the resources and application behavior in the restored namespace.

Check backups

Use the following command to confirm the backup object exists, see its status, and inspect what Velero captured.

velero backup get -n openshift-adp
velero backup describe virtana-io-backup-16sep-01 -n openshift-adp

If the backup is not Completed:

  • Re-check your MinIO connectivity (S3 URL, bucket, credentials) and that the BackupStorageLocation/DPA is valid.

  • Review Velero/OADP logs.

Check restores

Use the following command to confirm the restore object exists, see its status, and inspect the restored items.

velero restore get -n openshift-adp
velero restore describe virtana-io-restore-16sep-01 -n openshift-adp

In the describe output, verify:

  • The restore is using the intended backupName.

  • Any reported warnings/errors.

  • Restore duration and item counts.

Verify in the namespace

It verifies that Velero has completed, the restored application is healthy, and the data is correct.

Minimum checks to perform in the target namespace:

  • Workloads are present and running.

  • PVCs and PVs are restored with correct data and bound.

  • Ensure Services exist and endpoints are populated.

  • Validate that PV-backed application data is present.

UI Validation

User-facing sanity check to confirm the Virtana Platform is functioning correctly after a backup or restore. After Velero reports the restore as Completed, log in to the application UI and navigate through key pages to verify that core features load, expected data is present, and common actions behave normally.

Backup and Restore in a Kubernetes Cluster with Velero

This section walks you through setting up and using Velero for backup and restore operations in a Kubernetes cluster, with MinIO as the S3-compatible object storage backend.

Prerequisites

Before you begin, ensure your environment meets the following requirements:

  • A running Kubernetes cluster where workloads are deployed.

  • Installed and configured, used to deploy the MinIO chart.

  • Command-line access to interact with the cluster.

  • Required to pull Helm charts and container images.

  • Every pod whose volumes you want backed up must include the following annotation in spec.template.metadata.annotations:

    annotations:
      backup.velero.io/backup-volumes: "*"

Install MinIO (Object Storage)

MinIO is a high-performance, S3-compatible object storage system that serves as the backend where Velero stores all backup data. Installing MinIO within your cluster gives you a self-hosted, lightweight storage target.

Add Helm repo and update

In this step, you configure your local Helm client to trust and pull charts from the official MinIO Helm chart repository. Run the following command to add the MinIO Helm repository and refresh chart indices.

helm repo add minio https://charts.min.io/
helm repo update

helm repo add registers the MinIO chart repository URL with your local Helm configuration, and helm repo update refreshes Helm’s local chart index so it can discover the latest available chart versions before you install or upgrade MinIO.

Create MinIO values file

The values file lets you customize the MinIO deployment in a repeatable, version-controlled way. Here, it is used to set MinIO to standalone mode, enable persistent storage for backups, specify resource requests, configure service exposure, and control optional components like the MinIO console.

Create a file named minio-values.yaml with the following configuration:

mode: standalone
persistence:
  enabled: true
  size: 50Gi
resources:
  requests:
    memory: 512Mi
    cpu: 250m
rootUser: "minioadmin"
rootPassword: "minioadmin"
service:
  type: ClusterIP
replicas: 1
console:
  enabled: false

The following table provides the details of each field of the above configuration file:

Table 136.

Field

Description

Default value

mode

MinIO deployment mode. standalone runs a single instance.

standalone

persistence.enabled

Ensures data is stored on a PersistentVolume and survives pod restarts.

true

persistence.size

Requested PV capacity for object data.

50Gi

resources.requests.memory/cpu

Minimum guaranteed resources for stable performance.

rootUser/rootPassword

Bootstrap admin credentials for MinIO.

service.type

Exposure method inside the cluster. ClusterIP limits access to in-cluster clients.

ClusterIP

replicas

Number of MinIO pods. 1 for standalone.

1

console.enabled

Enables/disables MinIO Web Console. Disabled here for simplicity and minimal attack surface.

false



Install MinIO

Run the following command to install MinIO in its own namespace using the values file.

helm upgrade --install minio minio/minio \
  -n minio --create-namespace \
  -f minio-values.yaml \
  --version 5.4.0

Configure Buckets with MinIO client (mc)

This step prepares MinIO so that Velero has a known bucket to store backups and a dedicated set of credentials with the right permissions. Open a terminal inside the MinIO container, configure an mc (MinIO Client) alias to point to the MinIO service endpoint. After establishing the connection, create the required bucket, provision a user, and assign the appropriate access permissions.

kubectl exec -it deploy/minio -n minio -- bash
# Inside pod:
mc alias set localminio http://minio:9000 minioadmin minioadmin
mc mb localminio/velero
mc admin user add localminio velero-user vP@assWoRd
mc admin policy attach localminio readwrite --user velero-user
mc ls localminio

Configure cloud credentials for Velero

Configuring cloud credentials enables Velero to authenticate to the MinIO object storage in order to write backups and read them back during restores. Create a Kubernetes Secret named cloud-credentials.yaml containing the access key and secret key in the AWS credential format that Velero expects.

apiVersion: v1
kind: Secret
metadata:
  name: cloud-credentials
  namespace: velero
stringData:
  cloud: |
    [default]
    aws_access_key_id = velero-user
    aws_secret_access_key = vP@assWoRd

The following table defines each field of the above configuration:

Table 137.

Field

Description

Default value

metadata.name

Secret name referenced by OADP/Velero.

cloud-credentials

metadata.namespace

Must match the OADP operator namespace.

velero

stringData.cloud

AWS-style credentials file. Values are injected into Velero for S3-compatible access to MinIO. Replace with your secure credentials.



Run the command to apply the cloud-credentials.yaml so that Velero can use these credentials to access the MinIO S3 bucket for backups and restores.

kubectl apply -f cloud-credentials.yaml

Deploy Velero client pod

This step creates a pod that runs the Velero CLI, which you use to execute backup and restore commands. The pod mounts the cloud credentials secret so Velero can authenticate with MinIO.

Create the velero-client.yaml configuration file:

apiVersion: v1
kind: Pod
metadata:
  name: velero-client
  namespace: velero
spec:
  containers:
  - name: velero
    image: velero/velero:v1.12.0
    command: ["/bin/sh"]
    args: ["-c", "sleep infinity"]
    volumeMounts:
    - name: cloud-credentials
      mountPath: /credentials
      readOnly: true
  volumes:
  - name: cloud-credentials
    secret:
      secretName: cloud-credentials

The following table defines each field of the above configuration:

Table 138.

Field

Description

Default value

metadata.namespace

Namespace to access the credentials secret and Velero CRDs.

velero

spec.containers[].image

The Velero container image and version.

velero/velero:v1.12.0

spec.containers[].command/args

Runs a shell that sleeps indefinitely, keeping the pod alive so you can kubectl exec into it.

spec.containers[].volumeMounts[].mountPath

Path inside the container where the credentials file is mounted.

/credentials

spec.containers[].volumeMounts[].readOnly

Prevents the container from modifying the credentials.

true

spec.volumes[].secret.secretName

References the cloud-credentials secret created before.

cloud-credentials



Run the command to apply the manifest to deploy the Velero client pod, which will mount the cloud credentials and remain running for you to execute backup and restore commands.

kubectl apply -f velero-client.yaml

Create a tuned Backup Storage Location (BSL) (optional)

The Velero configuration uses the information to know where backups are stored and how to connect to that storage. The BSL points Velero to the MinIO S3-compatible service and the velero bucket, so backups and restore artifacts are consistently written to the correct location.

Create a tuned BSL for faster uploads, backup-storage-location.yaml.

apiVersion: velero.io/v1
kind: BackupStorageLocation
metadata:
  name: default
  namespace: velero
spec:
  provider: aws
  objectStorage:
    bucket: velero
    prefix: backups
  config:
    region: minio
    s3ForcePathStyle: 'true'
    s3Url: 'http://minio.minio.svc.cluster.local:9000'
    maxParallel: "10"
    maxRetries: "5"
    maxRetriesBackoff: "2s"
    partSize: "104857600"
  credential:
    name: cloud-credentials
    key: cloud
  default: true

The following table defines each field of the above configuration:

Table 139.

Field

Description

Default value

metadata.namespace

The namespace where Velero is running.

velero

spec.provider

The storage provider type.

aws

objectStorage.bucket/prefix

Components where backup objects are written within MinIO.

config.region/s3ForcePathStyle/s3Url

The endpoint URL of the S3-compatible object store, pointing to the in-cluster MinIO service.

http://minio.minio.svc.cluster.local:9000

config.maxParallel

The maximum number of parallel upload/download operations Velero performs against this storage location.

10

config.maxRetries

The maximum number of times Velero retries a failed S3 operation before marking it as failed.

5

config.maxRetriesBackoff

The wait duration between retries, using an exponential backoff strategy.

2s

config.partSize

The size of each part in a multipart upload to S3.

104857600

credential.name/key

The name of the Kubernetes Secret that contains the S3 access key and secret key.

default

When true, this location is used as the default destination for all Velero backups unless another location is explicitly specified in the backup command.

true



Run the command to apply the manifest, registering MinIO as Velero's default backup storage location with the configured connection and performance settings.

kubectl apply -f backup-storage-location.yaml

Create a backup

Creating a backup is the step where you define what data and Kubernetes resources Velero should capture and how the backup should be executed and retained.

Create a backup:

velero backup create virtana-io-backup-16sep-01 \
  --include-namespaces virtana-io \
  --ttl 72h

Adjust parameters as required. See Velero Backup Reference for more details.

Run the command to check the backup status:

velero backup get
velero backup describe virtana-io-backup-16sep-01

Restore from Backup

When you need to recover workloads, Velero can restore all resources from a previously created backup. This recreates the Kubernetes objects and restores persistent volume data.

Run the command to restore from backup:

velero restore create virtana-io-restore-16sep-01 \
  --from-backup virtana-io-backup-16sep-01

Adjust parameters as required. See Velero Restore Reference for more details.

Run the command to check the restore status:

velero restore get
velero restore describe virtana-io-restore-16sep-01

Validation

After a backup or restore operation, verify that it completed successfully by checking the status of both the Velero operations and the restored workloads.

Run the command to check the backup and restore status:

velero backup get
-and-
velero restore get

Verify workloads

As a final step, confirm that all pods, persistent volume claims, and services in the restored namespace are running as expected.

Run the following command to verify the workload:

kubectl get pods -n virtana-io
kubectl get pvc -n virtana-io
kubectl get svc -n virtana-io