Backup - Client
Consul
Find the IP of the server where Consul is running (in case you have a multi-node cluster):
kubectl get pod/gv-essentials-consul-server-0 -o jsonpath='{.spec.nodeName}'
Log into the server using SSH and execute the following command to take a snapshot of
Consul:
kubectl exec -it gv-essentials-consul-server-0 -- consul snapshot save /consul/data/backup.snap
Find the path where the snapshot has been saved
to:
kubectl get pvc/data-default-gv-essentials-consul-server-0 -o jsonpath='{.spec.volumeName}' | xargs -I{} kubectl get pv/{} -o jsonpath='{.spec.hostPath.path}'
Copy the snapshot file to a safe place.
PostgreSQL
Find the IP of the server where the PostgreSQL master is running (in case you have a multi-node cluster):
kubectl get pod/gv-postgresql-0 -o jsonpath='{.spec.nodeName}'
Log into the server using SSH and execute the following command to backup all
databases:
kubectl exec -it gv-postgresql-0 -- bash -c "pg_dumpall -U gv | gzip > /home/postgres/pgdata/backup.sql.gz"
Find the path where the backup has been saved
to:
kubectl get pvc/pgdata-gv-postgresql-0 -o jsonpath='{.spec.volumeName}' | xargs -I{} kubectl get pv/{} -o jsonpath='{.spec.hostPath.path}'
Copy the backup file to a safe place.