Skip to main content
Version: 3.1

Place replicas within the same domain

Once your Portworx cluster is operational, the replica 2 volumes will distribute their replicas across the two cluster domains. You can control this behavior using the Metro DR domain protection flag, which is enabled by default.

You can run the following command to check if the protection flag is enabled in your setup:

PX_POD=$(kubectl get pods -l name=portworx -n <portworx-namespace> -o jsonpath='{.items[0].metadata.name}') \ 
kubectl exec $PX_POD -n <portworx-namespace> -- /opt/pwx/bin/pxctl cluster options list | grep Metro

If you want the volume replica of a specific volume (for example, monitoring data volumes) to be created within the same cluster domain, label the volume with disable-domain-protection. This label disables the Metro DR domain protection flag at the individual volume level, rather than at the cluster level.

caution

The volumes with the disable-domain-protection label will not be protected by Synchronous DR. In the event of a disaster, you will lose the data associated with these volumes.

  1. Create the following StorageClass:

    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
    name: disable-domain-protection-sc
    provisioner: kubernetes.io/portworx-volume
    parameters:
    repl: "2"
    disable-domain-protection : "true"
    allowVolumeExpansion: true
  2. Save and apply the above spec:

    kubectl apply -f <your-storageclass>.yaml
  3. Create a PVC which references the StorageClass you created above, specifying the StorageClass:

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
    name: <application>-pvc
    spec:
    storageClassName: disable-domain-protection-sc
    accessModes:
    - ReadWriteOnce
    resources:
    requests:
    storage: 2Gi
  4. Save and apply your PVC with the kubectl apply command:

    kubectl apply -f <your-storageclass>.yaml

    The above PVC will have its replicas placed within the same cluster domain.

Was this page helpful?