vmblog logo 2024 wht (updated)

Kubernetes Cookbook: A Recipe for Multi-cloud and Multi-region Disaster Recovery in Minutes

Share: 

David Marshall | Published: November 5, 2019

By Ashar Rizqi, Co-Founder and CEO of Blameless

An unplanned disruption to your critical applications can be crippling to your business. Unforseen system errors, cyber attacks, widespread power and network outages, or bad code pushes can result in a catastrophic unavailability of your apps. In 2016, DNS provider Dyn came under a serious DDoS attack which made major internet services and platforms such as Airbnb, HBO, and Github unavailable. Dyn lost a big chunk of its customer base due to this outage.  Events like this reinforce the critical need for a disaster recovery strategy in order to maintain successful operation of an internet business.

Reasons your organization is failing at Disaster Recovery

Planning and executing for a disaster in today’s tech world is not easy. There are key reasons why some organizations struggle with this more than others. These reasons include the following:

  1. Your infrastructure lacks homogeneity; you have a mix of physical servers, virtual machines running inside your data centers, public cloud machines, and containers. Apps and supporting tools are closely tied to the underlying infrastructure. They become dependent on environments such as a cloud provider specific API or network architecture.
  2. You don’t have sufficient monitoring or SLOs in place to know when something is working correctly. Health checking is manual.
  3. Operational runbooks are created to manage the DR process. The problem with these is that they are long, manual, step-by-step guides that quickly become out of date as the application changes.

Organizations need to correct these issues if they want to be able to create effective disaster relief playbooks. Thankfully, there are open source tools to help with this.

Kubernetes, Terraform, and Helm to the rescue

Kubernetes (K8s), Terraform, and Helm can assist organizations by handling deployments, monitoring, health checking, and more. They each have unique benefits and work well in conjunction with each other. Kubernetes manages containerized applications and handles things like scale, deployments, and health checking. Kubernetes also abstracts away enough infrastructure and deployment complexity so apps are designed with a set of clean interfaces and a separation of concerns. Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Lastly, Helm is an open source package manager for Kubernetes that helps you define, install, and upgrade Kubernetes applications.

Together, they can fix the issues that prevent an organization from being able to create efficient and reliable disaster recovery strategies. This allows the organization to improve in the following ways:

  1. The infrastructure now looks homogeneous to the containerized apps. You no longer need hard dependencies on the underlying infrastructure or network implementation, and with infrastructure as code, you are able to rebuild and track changes to infrastructure with ease.
  2. Terraform standardizes the deployment of the infrastructure and keeps the underlying compute, network and storage resources consistent. You can use the same code to spin up a new environment in a different cloud within minutes.
  3. Containerized apps follow the 12-factor app model which provides standard interfaces for monitoring and health checking. These interfaces plug easily into Kubernetes, orchestrating how the systems are monitored and deployed.
  4. Operational runbooks become fully automated as Kubernetes, Terraform, and Helm manage deployments, auto-scaling, and health checking for both the infrastructure and apps.

A recipe for DR

Although Kubernetes, Terraform and Helm are not silver bullets, they do make disaster recovery for your stateless applications dramatically easier and less stressful. All major cloud providers have Kubernetes as a service available in most major regions around the world. With this in mind, here is a simple K8s disaster recovery recipe that’s applicable to many organizations.

  1. Use Terraform to setup your infrastructure with different providers in different regions. You should also setup K8s infrastructure with different cloud providers in different regions. For example, set one up in both AWS us-west-2 (Oregon) and GCP us-east-4 (Virginia).
  2. Use Helm for your Kubernetes applications. The configuration setup is a one-time cost and the same configs can be applied to different regions. Helm will rehydrate these regions with the correct instances of the applications.
  3. Wait for the platform to become available by testing the public health check endpoint.
  4. Route traffic to the new instance and make your customers happy.

Depending on the size and complexity of your applications, you can rehydrate your applications and serve user traffic within a span of minutes.

Time to get cooking

Planning and implementing a disaster recovery strategy is challenging with the technical complexity of your environment. Fortunately, Kubernetes, Terraform, and Helm make aspects of disaster recovery simple by eliminating much of the infrastructure, tooling, and deployment complexity.

##

About the Author

Ashar Rizqi 

Ashar Rizqi is Co-Founder and CEO of Blameless Inc., a Silicon Valley company building the next generation SRE platform. Prior to Blameless, Ashar led SRE and Platform Engineering teams at Box and Mulesoft after a stint as an Enterprise Systems Engineer at Fidelity Investments.