Restore Grafana
This guide shows you how to restore Grafana in your Rhize environment.
Prerequisites
Before you start, ensure you have the following:
Steps
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 tolibre
, run this command:kubectl config set-context --current --namespace=libre
For a reference of useful
kubectl
commands, refer to the official kubectl Cheat Sheet.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
Copy the checksum file into the new Grafana Pod within the
/home/grafana
directory:kubectl cp ./backup.sums \ <GRAFANA_POD_NAME>:/home/grafana
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
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
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
Untar the data file:
tar -xvf <LATEST_DATA_FILE>.tar.gz --directory /
Untar the configuration file:
tar -xvf <LATEST_CONF_FILE>.tar.gz --directory /home/grafana/
Move over the top of current configuration.
âšī¸Typically some files are configured as a KubernetesConfigMap
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/
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
Restart the Grafana Deployment.
kubectl rollout restart deployment grafana -n libre