In a previous article, I explained the role etcd plays in a Kubernetes cluster.

A Closer Look At Etcd: The Brain Of A Kubernetes Cluster

What etcd contains and how it organizes information

medium.com

We saw examples of the information etcd contains, the different ways it can be installed (inside or outside of the cluster), and how the etcd nodes exchange information through the Raft distributed concensus algorithm. All of that makes etcd a vital component of a Kubernetes cluster.

In today’s article, we will use Rancher’s RKE clusters and see how we can backup etcd from one cluster and restore it in the other one. This illustrates the case where a cluster goes wrong (it happens, unfortunately) and we need to restore it in a spare one.

We will follow the steps below:

  • A quick introduction to Rancher’s RKE
  • Creation of two Kubernetes clusters
  • Backup etcd on the first cluster
  • Restoration of etcd on the second cluster

About Rancher RKE

Rancher Labs is a company mainly known for its main product, Rancher, which is a management platform for Kubernetes. Rancherallows us to manage many clusters within the same interface. It covers cluster provisioning, user access control, workload deployment (via an integrated application catalog), and much, much more…

Image for post

Application catalog in Rancher

Rancher Labs is also known in the open-source ecosystem for other great projects:

  • RKE: a CNCF-certified Kubernetes distribution that runs entirely within Docker containers (that’s the one we will demo in this article).
  • K3s: a lightweight Kubernetes distribution (mainly dedicated to run at the edge and ARM devices but really great on standard x86).
  • Longhorn: a distributed block storage solution for Kubernetes. It went GA a couple of weeks ago, but has been in active development for over two years. Longhorn is managed by the CNCF and it’s currently among the sandbox projects (it will probably move to the incubating stage pretty soon)

In this article, we will focus on RKE as this is a really great tool to set up and manage Kubernetes clusters.

The rke binary can easily be installed on MacOS, Linux, or Windows (https://rancher.com/docs/rke/latest/en/installation/). Once installed, we can list all the available commands and options.

Image for post

rke’s available commands and options.

In the following, we will demo the commands used to create a cluster and the ones used to backup and restore the cluster’s underlying etcd.

#aws #devops #kubernetes #containers #programming

Kubernetes Tips: Backup and Restore Etcd
2.80 GEEK