Global Cluster Disaster Recovery

Disaster Recovery Path

This page documents disaster recovery for global clusters running on a non-Alauda OS. If the global cluster uses Alauda OS, follow Global Cluster Disaster Recovery on Alauda OS instead.

Overview

This solution is designed for disaster recovery scenarios involving the global cluster. The global cluster serves as the control plane of the platform and is responsible for managing other clusters. To ensure continuous platform service availability when the global cluster fails, this solution deploys two global clusters: a Primary Cluster and a Standby Cluster.

The disaster recovery mechanism is based on real-time synchronization of etcd data from the Primary Cluster to the Standby Cluster. If the Primary Cluster becomes unavailable due to a failure, services can quickly switch to the Standby Cluster.

Supported Disaster Scenarios

  • Irrecoverable system-level failure of the Primary Cluster rendering it inoperable;
  • Failure of physical or virtual machines hosting the Primary Cluster, making it inaccessible;
  • Network failure at the Primary Cluster location resulting in service interruption;

Unsupported Disaster Scenarios

  • Failures of applications deployed within the global cluster;
  • Data loss caused by storage system failures (outside the scope of etcd synchronization);

The roles of Primary Cluster and Standby Cluster are relative: the cluster currently serving the platform is the Primary Cluster (DNS points to it), while the standby cluster is the Standby Cluster. After a failover, these roles are swapped.

Notes

  • This solution only synchronizes etcd data of the global cluster; it does not include data from registry, chartmuseum, or other components;

  • Monitoring and logging data is not synchronized either. Each global cluster must collect, store, and query only its own metrics and logs; do not let the Primary Cluster and the Standby Cluster share one monitoring or logging system. Do not store workload cluster monitoring or logging data in the Primary Cluster or the Standby Cluster: install monitoring and logging in each workload cluster, or send them to a separate central cluster that is not a global cluster. Observability data held in the Primary Cluster is unavailable after a failover, so a Standby Cluster that depends on it cannot observe the platform it has just taken over;

  • In favor of facilitating troubleshooting and management, it is recommended to name nodes in a style like standby-global-m1, to indicates which cluster the node belongs to (Primary or Standby).

  • Disaster recovery of application data within the cluster is not supported;

  • Stable network connectivity is required between the two clusters to ensure reliable etcd synchronization;

  • If the clusters are based on heterogeneous architectures (e.g., x86 and ARM), use a dual-architecture installation package;

  • The following namespaces are excluded from etcd synchronization. If resources are created in these namespaces, users must back them up manually:

    cpaas-system
    cert-manager
    default
    global-credentials
    cpaas-system-global-credentials
    kube-ovn
    kube-public
    kube-system
    nsx-system
    cpaas-solution
    kube-node-lease
    kubevirt
    nativestor-system
    operators
  • If both clusters were upgraded from an earlier version and still use the platform built-in Registry, upload container images separately to each cluster;

  • If the Primary Cluster deploys DevOps Eventing v3 (knative-operator) and instances thereof, the same components must be pre-deployed in the standby cluster.

Process Overview

  1. Prepare a unified domain name for platform access and, if each cluster uses its own registry, a registry domain name;
  2. Point the domain to the Primary Cluster's VIP and install the Primary Cluster. With one registry per cluster, point the registry domain to the registry of the Primary Cluster as well;
  3. Temporarily switch DNS resolution to the standby VIP, and with one registry per cluster to the registry of the Standby Cluster, to install the Standby Cluster;
  4. Copy the ETCD encryption key of the Primary Cluster to the nodes that will later be the control plane nodes of Standby Cluster;
  5. Install and enable Global Cluster Disaster Recovery;
  6. Verify sync status and perform regular checks;
  7. In case of failure, switch DNS to the standby cluster to complete disaster recovery. With one registry per cluster, also switch the registry domain if the registry of the Primary Cluster is no longer available.

Required Resources

  • A unified domain which will be the Platform Access Address, and the TLS certificate plus private key for serving HTTPS on that domain;
  • A dedicated virtual IP address for each cluster — one for the Primary Cluster and another for the Standby Cluster;
  • An external platform image registry, prepared as described in Registry Setup.

Registry Setup

Both clusters must use the same registry address and account. Use one of these setups:

  • One external platform image registry that both clusters share.
  • One registry per cluster, behind one domain name, the registry domain. The registry domain is the registry address that you set on both clusters. For the procedure with mirror-registry, see the section Deploy mirror-registry for Disaster Recovery in Create an Image Registry with mirror-registry.

The registries of the two clusters do not synchronize data. With one registry per cluster, upload the platform images and the packages of ACP Common Aligned Extensions to both registries, as described in Prepare the Target-Version Payload.

Network Requirements

The unified domain is a prerequisite for disaster recovery. During normal operation, the domain resolves only to the Primary Cluster VIP. The Standby Cluster uses the domain to access platform services on the Primary Cluster.

With one registry per cluster, the registry domain resolves to the registry of the cluster that the platform domain points to while you install the clusters. After a failover, it has to change only if the registry of the former Primary Cluster is no longer available, as described in the failover steps below.

Before installing either cluster, configure the load balancers of both clusters and allow the flows in both directions between the Primary Cluster and Standby Cluster networks, as listed in the Communication Matrix.

Procedure

Step 1: Install the Primary Cluster

NOTES OF DR (Disaster Recovery Environment) INSTALLING

While installing the primary cluster of the DR Environment,

  • First of all, documenting all of the parameters set while following the guide of the installation web UI. It is necessary to keep some options the same while installing the standby cluster.
  • A load balancer MUST be preconfigured to route traffic sent to the virtual IP — either a User-provisioned load balancer or, from ACP 4.4, the Self-built VIP option.
  • The Platform Access Address field MUST be a domain, while the Cluster Endpoint MUST be the virtual IP address.
  • Both clusters MUST be configured to use An Existing Certificate (has be the same one), request a legit certificate if necessary. The Self-signed Certificate option is NOT available.
  • Use the external platform image registry prepared for the installation, as described in Registry Setup. With one registry per cluster, set the registry domain as the registry address. For an authenticated registry, set both Username and Password.
  • Both HTTP Port and HTTPS Port fields of Platform Access Address MUST be 80 and 443.
  • When coming to the second page the of the installation guide (Step: Advanced), the Other Platform Access Addresses field MUST include the virtual IP of current Cluster.

Refer to the following documentation to complete installation:

Step 2: Install the Standby Cluster

  1. Temporarily point the platform domain name to the standby cluster's VIP. With one registry per cluster, also point the registry domain to the registry of the standby cluster;

  2. Log into the first control plane node of the Primary Cluster and copy the etcd encryption config to all standby cluster control plane nodes:

    # Assume the primary cluster control plane nodes are 1.1.1.1, 2.2.2.2 & 3.3.3.3
    # and the standby cluster control plane nodes are 4.4.4.4, 5.5.5.5 & 6.6.6.6
    for i in 4.4.4.4 5.5.5.5 6.6.6.6  # Replace with standby cluster control plane node IPs
    do
      ssh "<user>@$i" "sudo mkdir -p /etc/kubernetes/"
      scp /etc/kubernetes/encryption-provider.conf "<user>@$i:/tmp/encryption-provider.conf"
      ssh "<user>@$i" "sudo install -o root -g root -m 600 /tmp/encryption-provider.conf /etc/kubernetes/encryption-provider.conf && rm -f /tmp/encryption-provider.conf"
    done
  3. Install the standby cluster in the same way as the primary cluster;

  4. When the standby cluster is installed, point the platform domain back to the Primary Cluster VIP, and with one registry per cluster, the registry domain back to the registry of the Primary Cluster.

NOTES FOR INSTALLING STANDBY CLUSTER

While installing the standby cluster of the DR Environment, the following options MUST be set to the same as the primary cluster:

  • The Platform Access Address field.
  • All fields of Certificate.
  • The external platform image registry address and pull credentials MUST match those used by the Primary Cluster. With one registry per cluster, the address is the registry domain.
  • Important: ensure the credentials of image repository and the admin user match those set on the Primary Cluster.

and MAKE SURE you followed the NOTES OF DR (Disaster Recovery Environment) INSTALLING in Step 1.

Refer to the following documentation to complete installation:

Step 3: Enable etcd Synchronization

Before you install the plugin, check that Global Cluster Disaster Recovery is available on the standby global cluster. In the Web Console of that cluster, go to Marketplace > Cluster Plugins, select the global cluster, and look for the plugin; or run this command on the cluster:

kubectl get moduleplugin etcd-sync

If the plugin is available, continue with step 1. If the command reports NotFound, or the plugin is not listed, upload its package first, as described in Uploading Packages.

  1. Before installing the plugin, get the bearer token for accessing the API server of the primary global cluster from the primary global cluster. Copy the command output and use it when creating the etcd-sync-active-cluster-token Secret in the standby global cluster under the cpaas-system namespace. The Secret stores the token under the data key token.

    # Run this command on the primary global cluster.
    kubectl -n cpaas-system get secret k8sadmin -o jsonpath='{.data.token}' | base64 -d

    Copy the output value, then run this command on the standby cluster:

    PRIMARY_CLUSTER_TOKEN='<paste-the-token-from-the-primary-cluster>'
    kubectl -n cpaas-system create secret generic etcd-sync-active-cluster-token \
      --from-literal=token="${PRIMARY_CLUSTER_TOKEN}" \
      --dry-run=client -o yaml | kubectl apply -f -
  2. If the clusters use a load balancer and you leave Active Global Cluster ETCD Endpoints empty in step 5, configure the load balancer to forward port 2379 to control plane nodes of the corresponding cluster. ONLY TCP mode is supported; forwarding on L7 is not supported.

    INFO

    With the Self-built VIP, skip this step and set Active Global Cluster ETCD Endpoints in step 5.

  3. Access the standby global cluster Web Console using its VIP, and switch to Administrator view.

  4. Navigate to Marketplace > Cluster Plugins, select the global cluster.

  5. Find Global Cluster Disaster Recovery, click Install, and configure these parameters. In the parameter names, Active means the primary global cluster.

    • Set Active Global Cluster VIP to the VIP of the primary global cluster. This parameter is required.
    • Set Active Global Cluster ETCD Endpoints to the etcd addresses of the control plane nodes of the primary global cluster, https://<control-plane-node-ip>:2379, separated by commas. This parameter is required with the Self-built VIP. With a load balancer that forwards port 2379, you can leave it empty.
    • Set Standby Cluster ETCD Endpoints to the etcd address of the standby global cluster. Use the default value unless the local etcd service is exposed through a different endpoint.
    • Set Active Global Cluster Token Secret to etcd-sync-active-cluster-token.
    • Use the default value of Data Check Interval.
    • Leave Print detail logs disabled unless troubleshooting.

During installation, the system runs the etcd-sync-bootstrap Job before the etcd-sync Deployment starts. The plugin installation continues only after the Job prepares remote-etcd-ca, remote-etcd-issuer, and remote-etcd-client.

Verify the bootstrap Job and runtime resources:

kubectl get job -n cpaas-system etcd-sync-bootstrap
kubectl logs -n cpaas-system job/etcd-sync-bootstrap
kubectl get secret -n cpaas-system remote-etcd-ca
kubectl get issuer -n cpaas-system remote-etcd-issuer
kubectl get certificate -n cpaas-system remote-etcd-client
kubectl get secret -n cpaas-system remote-etcd-client

Verify the sync Pods are running on the standby cluster and identify the current leader:

kubectl get po -n cpaas-system -l app=etcd-sync
kubectl get lease -n cpaas-system etcd-sync-mirror
leader_pod=$(kubectl get lease -n cpaas-system etcd-sync-mirror -o jsonpath='{.spec.holderIdentity}')
kubectl logs -n cpaas-system "$leader_pod" | grep -E "Acquired leader lease|Start Sync update"

If resources with ownerReference dependencies need to be resynchronized, recreate the current leader Pod after Start Sync update appears:

leader_pod=$(kubectl get lease -n cpaas-system etcd-sync-mirror -o jsonpath='{.spec.holderIdentity}')
kubectl delete po -n cpaas-system "$leader_pod"

Check sync status:

mirror_svc=$(kubectl get svc -n cpaas-system etcd-sync-monitor -o jsonpath='{.spec.clusterIP}')
ipv6_regex="^[0-9a-fA-F:]+$"
if [[ $mirror_svc =~ $ipv6_regex ]]; then
  mirror_host="[$mirror_svc]"
else
  mirror_host="$mirror_svc"
fi
curl -g "http://${mirror_host}/check"

Output explanation:

  • LOCAL ETCD missed keys: Keys exist in the primary global cluster but are missing from the standby global cluster. Often caused by GC due to resource order during sync. Restart the current etcd-sync leader Pod to fix;
  • LOCAL ETCD surplus keys: Extra keys exist only in the standby cluster. For information only.

Install the cluster plugins that you need, for example Advanced Monitoring, only now: on both the Primary and the Standby Cluster, after both clusters are installed and synchronization runs.

Disaster Recovery Process

Verify primary/standby consistency before uninstalling Alauda Container Platform Global Cluster Disaster Recovery

This procedure uninstalls Global Cluster Disaster Recovery. Before you uninstall it, confirm that the standby cluster data is consistent with the primary cluster. Uninstalling the plugin while the standby is missing data that the primary holds can cause owner references to resolve incorrectly, and workload-cluster node Machine objects — including Alauda OS clusters, where this destroys the backing virtual machine — may be deleted. If the consistency check reports missed keys, do not uninstall the plugin; resolve the inconsistency or contact technical support first.

  1. Verify data consistency in the standby cluster (same check as in Step 3). If the check reports missed keys, the standby global cluster is not consistent with the primary global cluster: do not continue to the next step. Resolve the inconsistency or contact technical support first. On both clusters, also confirm that no Machine nodes are in a non-running state, and resolve any that are before continuing:

    kubectl get machines.platform.tkestack.io
  2. Uninstall Global Cluster Disaster Recovery;

  3. Switch the platform domain DNS to the standby VIP, which now becomes the Primary Cluster. With one registry per cluster, decide about the registry domain: if the registry of the former Primary Cluster is no longer available, switch the registry domain to the registry of the standby cluster. If that registry is still available, you can leave the registry domain unchanged. In both cases, the two registries must hold the same content;

  4. Verify DNS resolution:

    kubectl exec -it -n cpaas-system deployments/sentry -- nslookup <platform access domain>
    kubectl exec -it -n cpaas-system deployments/sentry -- nslookup <registry domain>    # only if you switched the registry domain
    # If not resolved correctly, restart coredns Pods and retry until success
  5. Clear browser cache and access the platform page to confirm it reflects the former standby cluster;

  6. Restart the following services (if installed):

    • Advanced Monitoring:

      kubectl delete po -n cpaas-system -l 'service_name in (alertmanager,vmselect,vminsert)'
    • cluster-transformer:

      kubectl delete po -n cpaas-system -l service_name=cluster-transformer
  7. If workload clusters send monitoring data to the primary global cluster, restart warlock in the workload cluster:

    kubectl delete po -n cpaas-system -l service_name=warlock
  8. On the original Primary Cluster, repeat the Enable etcd Synchronization steps, starting with the check that the plugin is available, to convert it into the new standby cluster.

Routine Checks

Regularly check sync status on the standby cluster:

mirror_svc=$(kubectl get svc -n cpaas-system etcd-sync-monitor -o jsonpath='{.spec.clusterIP}')
ipv6_regex="^[0-9a-fA-F:]+$"
if [[ $mirror_svc =~ $ipv6_regex ]]; then
  mirror_host="[$mirror_svc]"
else
  mirror_host="$mirror_svc"
fi
curl -g "http://${mirror_host}/check"

If any keys are missed, follow the instructions in the output to resolve them.

Uploading Packages

Upload the package only if the check in Step 3 shows that the plugin is not available. Get the package of Global Cluster Disaster Recovery from ACP Common Aligned Extensions and upload it with Violet v4.2.13 or later:

  • Violet signs in to the standby global cluster with an API token. Create the token in the Web Console of the standby global cluster: Profile > API Tokens.
  • Set both --platform-address and --dest-repo to the standby global cluster. Otherwise, the package goes to the primary global cluster.
  • --dest-repo is the address of the registry that the standby global cluster uses. With one shared registry, it is the registry address of the installation. With one registry per cluster, the registry domain may resolve to the registry of the other cluster, so use an address that reaches the registry of the standby global cluster instead.
  • If that registry needs no credentials, use --no-auth instead of the registry credentials.

For example:

read -rsp "Standby platform token: " STANDBY_TOKEN; printf '\n'
read -rsp "Standby registry password: " STANDBY_REGISTRY_PASSWORD; printf '\n'
violet push <etcd-sync-package>.tgz \
  --platform-address "https://<standby-vip>" --platform-token "${STANDBY_TOKEN}" \
  --dest-repo "<standby-registry-address>" --username "<registry-username>" --password "${STANDBY_REGISTRY_PASSWORD}"
unset STANDBY_TOKEN STANDBY_REGISTRY_PASSWORD

For details of the violet push subcommand, see Upload Packages.