Backup labeled namespaces


You can apply required labels to the namespaces using the CLI, filter the labeled namespaces with the UI and then backup all such namespaces in a single click.

Prerequisites:

  • The Stork version on your application cluster must be 23.2.0 and above for namespace and resource label filters.

    Add Namespace label field gets disabled if the required Stork version is not deployed on the cluster. In addition, UI displays the following error message:
    Stork error

Apply labels for namespaces

To apply labels for namespaces:

  • Run the below command:

    kubectl label namespace <name-of-namespace> <label_name_1> <label_name_2>………...<label_name_n>

    You can apply multiple unique labels (separated by a space) to a namespace in key-value format.

    NOTE: The key-value pair label format takes equals sign (=) as a separator.

  • Run the below command to list the namespaces with the applied labels:

    kubectl get namespace --show-labels
  • To remove the labels from the namespaces:

    kubectl label namespace <name-of-namespace> <name-of-labels>-

Filter and backup labeled namespaces

To filter or view the namespaces with preset labels and then take a backup of the listed namespaces in the UI:

  1. From the home page, navigate to the cluster where your namespace resides.

  2. In the Add Namespace label field, provide the required namespace label(s) that you applied through the CLI and then press Enter.

    NOTE: You can search a namespace with preset labels either by providing only key or key-value string in the Add Namespace label field. If you have applied multiple labels to a namespace, you can provide all the applied labels in the Add Namespace label field with a comma separator. UI displays the namespace(s) that match all the specified labels and auto-selects them to create a backup.

    Namespace resource labels

    Portworx Backup lists out and auto-selects all the namespaces with the preset labels. For more information on creating a backup, refer Create a backup

    Filtered namespaces

  3. Click Backup to back up all the namespaces with the preset label in a single-click.

Automate scheduled backups

If a namespace is yet to be created, you can still create a backup schedule for the future namespace with a label. Portworx Backup picks up the future namespace(s) with this label and automatically includes the namespace(s) as part of the schedule. In such a scenario, manual backup option gets disabled as no immediate backup is created.

If you have created a scheduled backup with one or few namespaces that have preset labels and add namespaces at a later point of time with the same label, scheduler auto-includes these namespaces to the scheduled backup.

To create a backup schedule when namespace is yet to be created:

  1. Type the required label in the Add Namespace label field.

    Future namespace

  2. Click Backup. In the Create Backup window, enter the values for the required fields. Note that manual backup option Now is disabled.

    Backup namespace

  3. Click Create. For more information on how to create a backup, refer Create a backup.

    Portworx Backup creates a scheduled backup successfully without any namespace in it.

    Empty backup

  4. After the backup is created, navigate to the Backups tab of the application cluster, click on the vertical ellipsis of newly created scheduled backup and choose Show details to view the backup details:

    Future namespace


Last edited: Wednesday, Mar 29, 2023