Longhorn is cloud native distributed block storage for Kubernetes that is easy to deploy and upgrade, 100 percent open source, and persistent. Longhorn’s built-in incremental snapshot and backup features keep volume data safe, while its intuitive UI makes scheduling backups of persistent volumes easy to manage. Using Longhorn, you get maximum granularity and control, and can easily create a disaster recovery volume in another Kubernetes cluster and fail over to it in the event of an emergency.

Getting Started with Longhorn Distributed Block Storage and Cloud Native Distributed SQLCloud Native Infrastructure Stack: Computing, deployment, administration, storage and database.

YugabyteDB is a cloud native, distributed SQL database that runs in Kubernetes environments, so it can interoperate with Longhorn and many other CNCF projects. If you’re not familiar with YugabyteDB, it is an open source, high-performance distributed SQL database built on a scalable and fault-tolerant design inspired by Google Spanner. Yugabyte’s SQL API (YSQL) is PostgreSQL wire compatible.

If you are an engineer looking for a way to easily start your application development on top of a 100 percent cloud native infrastructure, this article is for you. In this article, we’ll give you step-by-step instructions on how to deploy a completely cloud native infrastructure stack. The stack will consist of Google Kubernetes Engine, Rancher enterprise Kubernetes management tooling, Longhorn distributed block storage, and a YugabyteDB distributed SQL database.

Why Longhorn and YugabyteDB?

YugabyteDB is deployed as a StatefulSet on Kubernetes and requires persistent storage. Longhorn can be used for backing YugabyteDB local disks, allowing the provisioning of large-scale persistent volumes. Here are a few benefits to using Longhorn and YugabyteDB together:

  • There’s no need to manage the local disks — they are managed by Longhorn.
  • Longhorn and YugabyteDB can provision large-sized persistent volumes.
  • Both Longhorn and YugabyteDB support multi-cloud deployments, helping organizations avoid cloud lock-in.

Additionally, Longhorn can do synchronous replication inside a geographic region. In a scenario where YugabyteDB is deployed across regions, and a node in any one region fails, YugabyteDB would have to rebuild this node with data from another region, which would incur cross-region traffic. This could prove to be more expensive and yield lower recovery performance. With Longhorn and YugabyteDB working together, you can rebuild the node seamlessly because Longhorn replicates locally inside the region. This means YugabyteDB does not end up having to copy data from another region, which ends up being less expensive and higher in performance. In this deployment setup, YugabyteDB would only need to do a cross-region node rebuild if the entire region failed.

Prerequisites

Below is the environment that we’ll use to run a YugabyteDB cluster on top of a Google Kubernetes cluster with Longhorn.

Setting Up a Kubernetes Cluster and Rancher on Google Cloud Platform

Rancher is an open source project that provides a container management platform built for Kubernetes. Rancher makes it easy to run Kubernetes everywhere, meet IT requirements, and empower DevOps teams.

Rancher requires a Linux host with 64-bit Ubuntu 16.04 or 18.04 and at least 4GB of memory. In this example, we will set up a Google Kubernetes Engine (GKE) cluster using the Rancher UI that we will first install on a GCP VM instance.

A summary of the steps required to set up a Kubernetes Cluster on GCP with Rancher includes:

  • Create a Service Account with the required IAM roles in GCP
  • Create a VM instance running Ubuntu 18.04
  • Install Rancher on the VM instance
  • Generate a Service Account private key
  • Set up the GKE cluster through the Rancher UI

Creating a Service Account with the Required IAM Roles, and a VM Instance Running Ubuntu

The first thing we need to do is create a Service Account attached to a GCP project. To do this, go to IAM & admin > Service accounts.

create a Service Account attached to a google cloud platform account distributed sql longhorn howto

Select Create New Service Account, give it a name and click create.

Next, we then need to add the required roles to the Service Account to be able to set up the Kubernetes cluster using Rancher. Add the roles shown below and create the Service Account.

add the required roles to the Service Account distributed sql longhorn tutorial

Once the roles have been added, click Continue and Done.

Now we now have to create an Ubuntu VM instance that is hosted on the GCP. To do this, go to Compute Engine > VM Instances > Create New Instance.

create an Ubuntu VM instance that is hosted on the GCP distributed sql longhorn how to

For the purposes of this demo I’ve selected an n1-standard-2 machine type. To select the Ubuntu image, click Boot Disk > Change and choose Ubuntu under Operating System and Ubuntu 18.04 LTS under Version.

#databases #distributed sql #how to #kubernetes

Getting Started with Longhorn Distributed Block Storage and Cloud Native Distributed SQL
13.15 GEEK