Backing up projects and PVC yaml files of HPE Nimble storage

Procedure
  1. Log in to the cluster as an administrator using the Bastion host.
  2. List the project data to back up using the following command:
    oc get all >& get_all_data.txt
    NOTE:

    User will be logged into the kube-system project by default. User can see the project name using oc project.

  3. Export the project objects to a .yaml or .json file.
    • Export the project objects into a project.yaml file using the following command:
      oc get -o yaml --export all > project.yaml
    • Export the project objects into a project.json file using the following command:
      oc get -o json --export all > project.json
  4. Export the role bindings, secrets, service accounts, and persistent volume claims of the project using the following command:
    for object in rolebindings serviceaccounts secrets imagestreamtags cm egressnetworkpolicies rolebindingrestrictions limitranges resourcequotas dc ds pv pvc templates cronjobs statefulsets hpa deployments replicasets poddisruptionbudget endpoints oauthclient route rc is networkpolicies
    do
      oc get -o yaml --export $object > $object.yaml
    done
    
  5. List all the namespaced objects using the following command:
    oc api-resources --namespaced=true -o name >& api_resource.txt
  6. Take the backup of all the applications related yaml file, storage class, and PVC yaml files.
    1. Log in to the user specific project using the following command:
      oc project <user-project-name>
    2. Follow steps 1 to 5 for taking backup of all the user defined projects that are hosting the applications with related yaml files, storage class and pvc yaml files.