Generate and apply cluster pair


In Kubernetes, you must define a trust object called a ClusterPair. Portworx requires this object to communicate with the destination cluster. The ClusterPair object pairs the Portworx storage driver as well as the two Kubernetes clusters, allowing the volumes and resources to be migrated between clusters.

Generate a ClusterPair on the destination cluster

IMPORTANT:

  • In all examples, <migrationnamespace> is considered the admin namespace that will migrate all namespaces of your source cluster to the destination cluster. You can also specify a non-admin namespace, but only that namespace will be migrated. To learn how to set up an admin namespace, refer to the Set up a Cluster Admin namespace for Migration page.
  • You must run the pxctl commands in this document either on your worker nodes or from one of the Portworx pods.
  1. Run the following command by specifying the <your-clusterpair-name> and <migrationnamespace>to create a ClusterPair and save the resulting spec to a file named clusterpair.yaml:

    • <you-remote-cluster>: is the name of the Kubernetes object that will be created on the source cluster representing the pair relationship.
    • <migrationnamespace>: is the name of the Kubernetes namespace on the source cluster that you want to migrate to the destination cluster.

      storkctl generate clusterpair -n <migrationnamespace> <your-clusterpair-name> -o yaml > clusterpair.yaml
  2. Remove the options section from the clusterpair.yaml file:

      options:
         <insert_storage_options_here>: ""

Apply the generated ClusterPair on the source cluster

  1. Copy the clusterpair.yaml file to your source cluster.

  2. Apply the generated spec clusterpair.yaml:

      kubectl create -f clusterpair.yaml
  3. Check the status of the pairing on the source cluster:

      storkctl get clusterpair -n <migrationnamespace>
      NAME                       STORAGE-STATUS   SCHEDULER-STATUS   CREATED
      <your-clusterpair-name>      NotProvided      Ready              30 Nov 22 22:59 UTC

    On a successful pairing you will see the scheduler status as Ready. Since there is only one Portworx cluster spanning both Kubernetes clusters, there is no need to pair Storage, thus the storage status will be NotProvided.

If you see an error, you can get more information by running the following command:

kubectl describe clusterpair <your-clusterpair-name> -n <migrationnamespace>


Last edited: Wednesday, Feb 1, 2023