Edit Page

Restore Grafana

This guide shows you how to restore Grafana in your Rhize environment.

Prerequisites

Before you start, ensure you have the following:

Steps

  1. Confirm the cluster and namespace are correct:

    ## context
    kubectl config current-context
    ## namespace
    kubectl get namespace
    

    To change the namespace for all subsequent kubectl commands to libre, run this command:

    kubectl config set-context --current --namespace=libre
    

    For a reference of useful kubectl commands, refer to the official kubectl Cheat Sheet.

  2. If a checksum file does not exist for the latest backups, create one:

    sha256sum <LATEST_DATA_FILE>.tar.gz <LATEST_CONF_FILE>.tar.gz > backup.sums
    
  3. Copy the checksum file into the new Grafana Pod within the /home/grafana directory:

    kubectl cp ./backup.sums \
    <GRAFANA_POD_NAME>:/home/grafana
    
  4. Copy the Grafana data tar file into the new Grafana Pod within the /home/grafana directory:

    kubectl cp ./<LATEST_DATA_FILE>.tar.gz \
    <GRAFANA_POD_NAME>:/home/grafana
    
  5. Copy the Grafana configuration tar file into the new Grafana Pod within the /home/grafana directory:

    kubectl cp ./<LATEST_CONF_FILE>.tar.gz \
    <GRAFANA_POD_NAME>:/home/grafana
    
  6. Confirm that the checksums match:

    kubectl exec -it <GRAFANA_POD_NAME> -- /bin/bash 
    
    <GRAFANA_POD_NAME>:~$ cd /home/grafana
    <GRAFANA_POD_NAME>:~$ sha256sum -c backup.sums
    ./<LATEST_DATA_FILE>.tar.gz: OK
    ./<LATEST_CONF_FILE>.tar.gz: OK
    
  1. Untar the data file:

    tar -xvf <LATEST_DATA_FILE>.tar.gz --directory /
    
  2. Untar the configuration file:

    tar -xvf <LATEST_CONF_FILE>.tar.gz --directory /home/grafana/
    
  1. Move over the top of current configuration.

    Note Typically some files are configured as a Kubernetes ConfigMap and may need to be configured as part of installation. The following command prompts when it is going to overwrite a file, and if it has the permissions to do so.
    mv /home/grafana/usr/share/grafana/conf/* /usr/share/grafana/conf/
    
  2. Remove restore files and directory

    rm /home/grafana/<LATEST_DATA_FILE>.tar.gz
    rm /home/grafana/<LATEST_CONF_FILE>.tar.gz
    rm /home/grafana/backup.sums
    rm -r /home/grafana/usr
    
  3. Restart the Grafana Deployment.

    kubectl rollout restart deployment grafana -n libre