.. SPDX-FileCopyrightText: 2024 - 2025 Univention GmbH
..
.. SPDX-License-Identifier: AGPL-3.0-only

.. _backup-restore:

******************
Backup and restore
******************

This section describes backup and restore for Nubus for Kubernetes.
Having a backup comes in handy when you need it in case of an emergency or disaster.
Not having a backup in such a situation turns a disaster into a catastrophe.

This section doesn't describe the backup and restore for your Kubernetes cluster.
Instead, the following sections describe backup and restore of Nubus in its Kubernetes namespace,
the requirements for its backup,
and how to backup and restore Nubus.

This document doesn't recommend backing up of only a selection of Nubus components,
because restoring them can quickly become complicated
with data consistency and synchronization challenges.

For components you use in Nubus that aren't part of the Nubus deployment through the Helm Chart,
you need to design dedicated backup and restore concepts.
These components are beyond the scope of this document.

To follow along, the sections provide the following information:

* :ref:`Requirements for Kubernetes cluster and backup solution <backup-restore-requirements>`
* :ref:`backup-restore-tool`
* :ref:`Create a backup of Nubus for Kubernetes <backup-restore-backup>`
* :ref:`Create a restore of Nubus for Kubernetes <backup-restore-restore>`
* :ref:`Relational database PostgreSQL <backup-restore-databases>`

.. tip::

   Create a test deployment of Nubus in your Kubernetes cluster
   and familiarize yourself with the backup and restore process
   to ensure that the process works for you and produces the expected results.

.. important::

   The following sections describe an example,
   and the specific setup depends on the target environment where you deployed Nubus for Kubernetes.
   It demonstrates how to perform a backup to an S3-compatible storage bucket using :program:`Velero`.
   To keep the example simple,
   this documentation assumes that you have installed Velero and the S3 bucket **in the same Kubernetes cluster** as Nubus itself.

   ⚠️ In a practical scenario, it's **highly recommended** to place the S3 bucket target **outside** of the Kubernetes cluster,
   to allow for recovery in case the entire cluster fails. ⚠️

   For more details, refer to the documentation of Velero or the backup tool of your choice.


.. toctree::
   :caption: Contents

   requirements
   tool
   backup
   restore
   databases
