How to restore a single TKGi cluster when persistent disks for the cluster are lost.
Note: A few things to look out for before following the instructions:
tkgi clusters
bosh -d service_instance-<GUID-Problematic-cluster> vms
Product Version: 1.7
Note: These instructions are meant to be high-level in terms of explaining the procedure. It is assumed that you are familiar with the general procedure and know how to gather credentials required for the running the commands used in this procedure.
Example (cluster1 - is the test cluster)
tkgi create-cluster cluster1 -e cluster1.api.pks.example.com -p medium -n 1
After the cluster is created, run the following to display Instance, Process state, VM CIDs, and Disk CIDs command:
bosh -d service-instance_<GUID> is --details --column=Instance --column=Process\ State --column=VM\ CID --column=Disk\ CIDs
Example output:
Instance Process State VM CID Disk CIDs apply-addons/#########-c207-4e78-a39d-############ - - - master/########-06fc-4f29-af72-############ running vm-########-5d44-4f7d-a4ec-############ disk-########-2060-40b2-a724-############ master/########-047d-4e04-bfbb-############ running vm-########-8269-4c0e-a4e1-############ disk-########-15f7-41a4-bc8b-############ master/########-80db-46ef-8d8b-############ running vm-########-ddc6-452a-b23e-############ disk-########-0969-4511-989b-############ worker/########-6b71-4108-9e3f-############ running vm-########-6211-44bc-b35d-############ disk-########-bd38-4a7e-82bb-############
Credentials for the following command can be gathered from here:
Prepare to Backup
pre-backup-check:
BOSH_CLIENT_SECRET='#####' bbr deployment --all-deployments --target #### --username ##### --ca-cert ##### pre-backup-check
backup:
Make sure to include --with-manifest option with the following command:
This is just a scenario which you can create to delete the persistent disks used by the test cluster. An equivalent event might have already happened in your environment in which case you can skip this step.
bosh -d service_instance-<GUID> orphan-disk <Disk CID>
bosh clean-up --all
From a previous backup or the backup created in Step 2, navigate to backup director (service_instance-<GUID-TIMESTAMP>) to use the manifest.yml for the following command to redeploy the test cluster (cluster1):
bosh -d service-instance_##### deploy service-instance_####_20200623T191343Z/manifest.yml --fix
This command will recreate the VMs of our test cluster (cluster1) and will also make sure that new persistent disks are provisioned and are attached to their corresponding VMs. After successful deployment, you will be able to access the test cluster using the TKG CLI (it might require you to login and get-credentials) but the cluster will not have any workloads running in it (kubectl get all -A) The next step will take care of restoring the stateless workloads for the test cluster.
This step only requires us to run the following BBR restore command to restore the stateless workloads:
BOSH_CLIENT_SECRET=#### nohup bbr deployment --deployment service-instance_##### --target ##### --username pivotal-container-service-#### --ca-cert xxxxx restore --artifact-path service-instance_####_####/
Where --artifact-path is the directory which contains the backup artifacts of the test cluster.
After this operation completes, you can do use TKG CLI to do tkgi login & get-credentials again and then do a sanity check to make sure that workloads are restored (kubectl get all -A).