Reader small image

You're reading from  Kubernetes - A Complete DevOps Cookbook

Product typeBook
Published inMar 2020
PublisherPackt
ISBN-139781838828042
Edition1st Edition
Concepts
Right arrow
Author (1)
Murat Karslioglu
Murat Karslioglu
author image
Murat Karslioglu

Murat Karslioglu is a distinguished technologist with years of experience using infrastructure tools and technologies. Murat is currently the VP of products at MayaData, a start-up that builds data agility platform for stateful applications, and a maintainer of open source projects, namely OpenEBS and Litmus. In his free time, Murat is busy writing practical articles about DevOps best practices, CI/CD, Kubernetes, and running stateful applications on popular Kubernetes platforms on his blog, Containerized Me. Murat also runs a cloud-native news curator site, The Containerized Today, where he regularly publishes updates on the Kubernetes ecosystem.
Read more about Murat Karslioglu

Right arrow
Disaster Recovery and Backup

In this chapter, we will focus on the backup and disaster recovery scenarios that keep applications in production highly available and allow them to quickly recover services during cloud provider or basic Kubernetes node failures. After following the recipes in this chapter, you will have gained the skills to operate the tools that are used for disaster recovery (DR) and be able to live-migrate applications across clusters and clouds.

In this chapter, we will cover the following recipes:

  • Configuring and managing S3 object storage using MinIO
  • Managing Kubernetes Volume Snapshots and restore
  • Application backup and recovery using Velero
  • Application backup and recovery using Kasten
  • Cross-cloud application migration

Technical requirements

The recipes in this chapter assume that you have a functional Kubernetes cluster deployed by following one of the recommended methods described in Chapter 1, Building Production-Ready Kubernetes Clusters.

The Kubernetes Operations tool kubectl will be used for the rest of the recipes in this chapter since it's the main command-line interface for running commands against Kubernetes clusters. If you are using a Red Hat OpenShift cluster, you can replace kubectl with oc. All the commands are expected to function in a similar fashion.

Configuring and managing S3 object storage using MinIO

In this section, we will create an S3 object storage using MinIO to store artifacts or configuration files created by your applications in Kubernetes. You will learn how to create deployment manifest files, deploy an S3 service, and provide an external IP address for other applications or users to consume the service.

Getting ready

Clone the k8sdevopscookbook/src repository to your workstation to use manifest files under the chapter6 directory, as follows:

$ git clone https://github.com/k8sdevopscookbook/src.git
$ cd src/chapter6

Make sure you have a Kubernetes cluster ready and kubectl configured so that you can manage the cluster resources.

How to do it…

This section is further divided into the following subsections to make this process easier:

  • Creating a deployment YAML manifest
  • Creating a MinIO S3 service
  • Accessing the MinIO web user interface

Creating a deployment YAML manifest

All Kubernetes resources are created in...

Managing Kubernetes Volume Snapshots and restore

In this section, we will create Volume Snapshots from our persistent volumes in Kubernetes. By following this recipe, you will learn how to enable the Volume Snapshot functionality, create snapshot storage classes, and restore from existing Volume Snapshots.

Getting ready

Make sure you have a Kubernetes cluster ready and kubectl configured to manage the cluster resources.

Clone the k8sdevopscookbook/src repository to your workstation to use the manifest files under the chapter6 directory, as follows:

$ git clone https://github.com/k8sdevopscookbook/src.git
$ cd src/chapter6

Make sure the Container Storage Interface (CSI) driver from your preferred storage vendor is installed on your Kubernetes cluster and has implemented the snapshot functionality. We covered the installation of the AWS EBS, GCP PD, Azure Disk, Rook, and OpenEBS CSI drivers in Chapter 5, Preparing for Stateful Workloads.

The instructions in this section work similarly with...

Application backup and recovery using Velero

In this section, we will create disaster recovery backups and migrate Kubernetes applications and their persistent volumes in Kubernetes using VMware Velero (formerly Heptio Ark).

You will learn how to install Velero, create standard and scheduled backups of applications with an S3 target, and restore them back to the Kubernetes clusters.

Getting ready

Make sure you have a Kubernetes cluster ready and kubectl configured to manage the cluster resources.

Clone the k8sdevopscookbook/src repository to your workstation to use the manifest files under the chapter6 directory, as follows:

$ git clone https://github.com/k8sdevopscookbook/src.git
$ cd src/chapter6

This recipe requires an existing stateful workload with presentable data so that we can simulate a disaster and then restore the data. To do this, we will use the mytestapp application we created during the Installing EBS CSI driver to manage EBS volumes recipe in Chapter 5, Preparing for Stateful...

Application backup and recovery using Kasten

In this section, we will create disaster recovery backups and migrate Kubernetes applications and their persistent volumes in Kubernetes using Kasten (K10).

You will learn how to install and use K10, create standard and scheduled backups of applications to an S3 target, and restore them back to the Kubernetes clusters.

Getting ready

Make sure you have a Kubernetes cluster ready and kubectl and helm configured so that you can manage the cluster resources. In this recipe, we will use a three-node Kubernetes cluster on AWS.

This recipe requires an existing stateful workload with presentable data to simulate a disaster. To restore the data, we will use the mytestapp application we created in the Installing EBS CSI Driver to manage EBS volumes recipe in Chapter 5, Preparing for Stateful Workloads.

Clone the k8sdevopscookbook/src repository to your workstation to use the manifest files under the chapter6 directory, as follows:

$ git clone https...

Cross-cloud application migration

When running applications on the cloud, it is important to have a plan in case cloud vendor service outages occur, as well as to avoid possible cloud lock-ins, by abstracting the storage layer using a cloud-native storage solution similar to the OpenEBS management layer that allows you to manage your exposure to each cloud or data center. In this section, we will migrate a cloud-native application from one Kubernetes cluster to another cluster running on a different cloud vendor to simulate a migration scenario. You will learn how to use backups to migrate applications using Kasten and OpenEBS Director.

Getting ready

Make sure you have two Kubernetes clusters ready and kubectl configured to manage the cluster resources.

In this recipe, we will use a cluster on AWS that's been deployed and managed by D2iQ Konvoy and a cluster that's been deployed using kops. As an example, we will migrate an existing minio application.

The instructions provided...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Kubernetes - A Complete DevOps Cookbook
Published in: Mar 2020Publisher: PacktISBN-13: 9781838828042
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Murat Karslioglu

Murat Karslioglu is a distinguished technologist with years of experience using infrastructure tools and technologies. Murat is currently the VP of products at MayaData, a start-up that builds data agility platform for stateful applications, and a maintainer of open source projects, namely OpenEBS and Litmus. In his free time, Murat is busy writing practical articles about DevOps best practices, CI/CD, Kubernetes, and running stateful applications on popular Kubernetes platforms on his blog, Containerized Me. Murat also runs a cloud-native news curator site, The Containerized Today, where he regularly publishes updates on the Kubernetes ecosystem.
Read more about Murat Karslioglu