Urgent.News

What's breaking now, across thousands of outlets.

Tech

Two Kubernetes clusters for disaster recovery shouldn't cost twice as much

Most multi-cluster HA setups run active/active, which means paying for full workloads on both clusters around the clock. For our production workloads, I wanted automatic disaster recovery without the standby cluster burning money every day. So I built an active/passive multi-cluster setup with Karmada ๐Ÿ‘‡ ๐Ÿ”น ๐—ข๐—ป๐—ฒ ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ผ๐—น ๐—ฝ๐—น๐—ฎ๐—ป๐—ฒ, ๐˜๐˜„๐—ผ ๐—ž๐˜‚๐—ฏ๐—ฒ๐—ฟ๐—ป๐—ฒ๐˜๐—ฒ๐˜€ ๐—ฐ๐—น๐˜‚๐˜€๐˜๐—ฒ๐—ฟ๐˜€ Karmadaโ€ฆ

Most multi-cluster high availability setups operate on an active/active basis, requiring full workloads on both clusters 24/7. To avoid the unnecessary costs of maintaining a standby cluster, a user designed an active/passive multi-cluster configuration using Karmada. The system utilizes K3s to manage both clusters, with deployments, services, ingress, configmaps, and secrets propagated through a single PropagationPolicy.

Workloads are automatically routed to the primary cluster using ClusterAffinities, staying on standby until the primary becomes unavailable. In the event of a failure, Automatic failover uses a ClusterTaintPolicy to move workloads to the backup cluster without manual intervention. However, once the primary cluster recovers, Karmada does not automatically shift the workloads back.

A CronJob-based fail-back mechanism was developed to address this issue, waiting for the primary cluster to remain healthy for 15 minutes before clearing scheduler affinity, triggering a reschedule, and moving workloads back to the primary cluster. Cloudflare Load Balancer was added for traffic management, implementing primary and backup pools, HTTPS/healthz monitoring, and automatic failover, eliminating the need for an additional HAProxy layer.

This approach provides disaster recovery without the continuous expenses of running full production capacity on both clusters. A step-by-step guide on the installation, cluster join, failover hardening, fail-back script, and load balancer options is available on GitHub.

Written by urgent.news from Dev.to's reporting โ€” not their text. Machine-written โ€” may contain errors; check the original before relying on it.

Read the original at dev.to โ†’

More in Tech

A No-Nonsense Cloud Landing Zone Checklist (Azure, AWS, Google Cloud)

If you've ever been handed a brand-new Azure subscription, AWS account or Google Cloud project and told to "just get something running," you already know the real problem isn't the workload.

  • Cloud landing zone is foundational platform for secure workload launch in Azure, AWS, Google Cloud
  • Key components include identity management, policies for security enforcement, centralized logging
  • Define identity provider, enforce MFA, avoid workloads in management account before deployment

More from Thursday 1 October โ†’