LATEST VERSION: v1.3 - RELEASE NOTES
Pivotal Container Service v1.3

Backing Up the Single Master Cluster

Page last updated:

This topic describes how to use BOSH Backup and Restore (BBR) to back up your single master cluster.

To perform a restore of a single master cluster with BBR, see the instructions in Restoring the Single Master Cluster.

Limitations

BBR has the following limitations:

  • BBR can only back up a single-master cluster.
  • BBR does not back up the contents of disks that are attached to nodes.
  • BBR only backs up and restores the cluster etcd data. This includes the cluster-deployed workloads. Persistent volumes and other IaaS resources, such as load balancers of workloads, are not backed up.
  • Backup and restore for clusters deployed on vSphere with NSX-T is not yet supported.

Prerequisites

Before using the result of the backup to restore to a destination environment, verify that the current environment and the destination environment are compatible. For more information, see Compatibility of Restore in Restoring the Single Master Cluster.

When running BBR to back up your cluster deployments, ensure that you are using the correct BOSH credentials, as described below, which limit the scope of BBR to only your cluster deployments.

Before you begin backing up your clusters, perform the following steps:

Download the Root CA Certificate

Download the root certificate authority (CA) certificate for your PKS deployment by following the steps below.

  1. From the Ops Manager Installation Dashboard, click your username in the top right corner.

  2. Navigate to Settings > Advanced.

  3. Click Download Root CA Cert.

Verify Your Cluster Deployment

To verify that you can reach your BOSH Director and that the BOSH Director has a deployment that can be backed up, follow the steps below.

  1. SSH into your jumpbox. For more information about the jumpbox, see Installing BOSH Backup and Restore.

  2. To perform the BBR pre-backup check, run the following command from your jumpbox:

    BOSH_CLIENT_SECRET=BOSH-TEAM-CLIENT-SECRET \
    bbr deployment \
    --all-deployments \
    --target BOSH-TARGET \
    --username BOSH-TEAM-CLIENT \
    --ca-cert PATH-TO-BOSH-SERVER-CERT \
    pre-backup-check
    

    Replace the placeholder text as follows:

    • BOSH-TEAM-CLIENT-SECRET: In the the Pivotal Container Service tile, navigate to Credentials > UAA Client Credentials. Record the value for uaa_client_secret.
    • BOSH-TARGET: In the BOSH Director tile, navigate to Credentials > Bosh Commandline Credentials. Record the value for BOSH_ENVIRONMENT. You must be able to reach the target address from the workstation where you run bbr commands.
    • BOSH-TEAM-CLIENT: In the BOSH Director tile, navigate to Credentials > UAA Client Credentials. Record the value for uaa_client_name.
    • PATH-TO-BOSH-CA-CERT: Use the path to the root CA certificate that you downloaded in the Prerequisites section.

    For example:

    $ BOSH_CLIENT_SECRET=p455w0rd \
    bbr deployment \
    --all-deployments \
    --target bosh.example.com \
    --username pivotal-container-service-xxxxxx \
    --ca-cert bosh.ca.cert \
    pre-backup-check
    

  3. If the pre-backup check command fails, do one or more of the following:

    • Run the command again, adding the --debug flag to enable debug logs. For more information, see Exit Codes and Logging.
    • Make the changes suggested in the output and run the pre-backup check again. For example, the deployment that you selected might not have the correct backup scripts, or the connection to the BOSH Director failed.

Back Up Your Cluster Deployment

To back up your cluster deployment, follow the steps below.

  1. Run the following command from your jumpbox:

    BOSH_CLIENT_SECRET=BOSH-TEAM-CLIENT-SECRET \
    nohup bbr deployment \
    --all-deployments \
    --target BOSH-DIRECTOR-IP \
    --username BOSH-TEAM-CLIENT \
    --ca-cert PATH-TO-BOSH-SERVER-CERT \
    backup [--with-manifest] [--artifact-path]
    

    Replace the placeholder text as follows:

    • BOSH-TEAM-CLIENT-SECRET: In the the Pivotal Container Service tile, navigate to Credentials > UAA Client Credentials. Record the value for uaa_client_secret.
    • BOSH-TARGET: In the BOSH Director tile, navigate to Credentials > Bosh Commandline Credentials. Record the value for BOSH_ENVIRONMENT. You must be able to reach the target address from the workstation where you run bbr commands.
    • BOSH-TEAM-CLIENT: In the BOSH Director tile, navigate to Credentials > UAA Client Credentials. Record the value for uaa_client_name.
    • PATH-TO-BOSH-CA-CERT: Use the path to the root CA certificate that you downloaded in the Prerequisites section.

    Specify optional flags for the backup subcommand:

    • --with-manifest: This includes the manifest in the backup artifact. If you use this flag, the backup artifact then contains credentials that you should keep secret.
    • --artifact-path: This allows you to specify a path for the backup artifact.

    For example:

    $ BOSH_CLIENT_SECRET=p455w0rd \
    nohup bbr deployment \
    --all-deployments \
    --target bosh.example.com \
    --username pivotal-container-service-xxxxxx \
    --ca-cert bosh.ca.cert \
    backup
    

    Note: The BBR backup command can take a long time to complete. You can run it independently of the SSH session so that the process can continue running even if your connection to the jumpbox fails. The command above uses nohup, but you could also run the command in a screen or tmux session.

  2. If the backup command completes successfully, follow the steps in Manage Your Backup Artifact below.

  3. If the backup command fails, do one or more of the following:

Recover from a Failing Command

If your backup fails, follow these steps below:

  1. Ensure that all the parameters in the command are set.

  2. Ensure that the BOSH Director credentials are valid.

  3. If you are backing up a deployment, ensure the deployment that you specify in the backup command exists.

  4. Ensure that the jumpbox can reach the BOSH Director.

  5. Consult Exit Codes and Logging.

  6. If you see the error message Directory /var/vcap/store/bbr-backup already exists on instance, run the appropriate cleanup command. See Clean Up after a Failed Backup below.

  7. If the backup artifact is corrupted, discard the failing artifacts and run the backup again.

Cancel a Backup

If you must cancel a backup, follow the steps below:

  1. Terminate the BBR process by entering Ctrl-C, then entering yes to confirm.

  2. Because stopping a backup can leave the system in an unusable state and prevent additional backups, follow the procedures in Clean Up after a Failed Backup below.

Clean Up after a Failed Backup

If you stop the backup process or the process fails, the BBR backup folder can remain on the instance, causing any subsequent attempts to backup to fail. In addition, if the interruption prevents BBR from running the post-backup scripts, the instance may be left in a locked state.

If you stop the backup process or the process fails, run the following command:

BOSH_CLIENT_SECRET=BOSH-TEAM-CLIENT-SECRET \
bbr deployment \
--all-deployments \
--target BOSH-TARGET \
--username BOSH-TEAM-CLIENT \
--ca-cert PATH-TO-BOSH-CA-CERT \
backup-cleanup

Replace the placeholder text as follows:

  • BOSH-TEAM-CLIENT-SECRET: In the the Pivotal Container Service tile, navigate to Credentials > UAA Client Credentials. Record the value for uaa_client_secret.
  • BOSH-TARGET: In the BOSH Director tile, navigate to Credentials > Bosh Commandline Credentials. Record the value for BOSH_ENVIRONMENT. You must be able to reach the target address from the workstation where you run bbr commands.
  • BOSH-TEAM-CLIENT: In the BOSH Director tile, navigate to Credentials > UAA Client Credentials. Record the value for uaa_client_name.
  • PATH-TO-BOSH-CA-CERT: Use the path to the root CA certificate that you downloaded in the Prerequisites section.

For example:

$ BOSH_CLIENT_SECRET=p455w0rd \
bbr deployment \
--all-deployments \
--target bosh.example.com \
--username pivotal-container-service-xxxxxx \
--ca-cert bosh.ca.crt \
backup-cleanup

If the cleanup script fails, consult the following table to match the exit codes to an error message.

Value Error
0 Success
1 General failure
8 The post-backup unlock failed. Your deployment might be in a bad state and require attention.
16 The cleanup failed. This is a non-fatal error indicating that the utility has been unable to clean up open BOSH SSH connections to the deployment VMs. Manual cleanup might be required to clear any hanging BOSH users and connections.

For more information about interpreting the exit codes, see Exit Codes in BBR Exit Codes and Logging.

Manage Your Backup Artifact

Keep your backup artifact safe in following ways:

  • Move the backup artifact off the jumpbox to a secure storage space. BBR stores each backup in a subdirectory named DEPLOYMENT-TIMESTAMP within the current working directory. The backup created by BBR consists of a folder that contains the backup artifacts and metadata files.

  • Compress and encrypt the backup artifacts when storing them.

  • Make redundant copies of your backup and store them in multiple locations. This can help minimize the risk of losing your backups in the event of a disaster.

  • Each time you redeploy PKS Cluster, test your backup artifact by following the procedures in Restore the Single Master Cluster.


Please send any feedback you have to pks-feedback@pivotal.io.

Create a pull request or raise an issue on the source for this page in GitHub