Cloud Native / Kubernetes / Storage

Tutorial: Install and Configure OpenEBS on Amazon Elastic Kubernetes Service

13 Mar 2020 9:47am, by

In a previous article, I introduced the architecture of the OpenEBS, an open source container attached storage package for Kubernetes. In this part, we will install and configure OpenEBS on the Amazon Elastic Kubernetes Service (EKS),  with a focus on the cStor Storage Engine.

By the end of this tutorial, you will have a storage pool that can be used for deploying highly available stateful workloads on Kubernetes.

Launching an Amazon EKS Cluster

The first step is to provision an Amazon EKS cluster with three nodes. Download and configure eksctl, the nifty tool to manage EKS clusters.

Attaching Amazon EBS Volumes to Worker Nodes

OpenEBS cStor storage engine creates a pool from attached block storage devices.

If you have a large cluster, you can label a subset of nodes for running stateful workloads and configure OpenEBS on the nodes.

Let’s create and attach an EBS volume to each node of the cluster. Before that, we need to get the Amazon EC2 instance id and availability zone of the worker nodes.

Note the volume id of the EBS device. We need it for the next step where we attach the volume to an instance from the same availability zone.

Repeat these steps for the remaining two nodes of the cluster. Make sure that the availability zone is the same for the EBS volume and EC2 instance (worker node).

By the end of this step, we have three EBS volumes of 20GiB each attached to the worker nodes.

Verify that the volumes are attached to the nodes with the below command:

The first volume is the root while the second volume is the disk that we attached.

Note: The steps involved in creating and attaching volumes to worker nodes can be easily automated through a BASH script or an AWS CloudFormation template.

Installing OpenEBS

We will use the OpenEBS operator to install it. This will create a dedicated namespace and deploys OpenEBS.

Wait for the Pods to become ready before proceeding to the next step.

The next step is to initialize Ubuntu to ensure that iSCSI service is up and running.

The last line confirms that iSCSI is initialized.

Configuring cStor Storage Engine on OpenEBS

With OpenEBS in place, we will now configure a storage engine based on cStor which will create a storage pool from the attached EBS volumes.

Let’s start by getting the block device id associated with the EBS volumes.

From these raw devices, we will now create a cStor storage pool. Add the list of block devices to the below YAML file and apply it.

This step can be easily automated through a BASH script by reading the output of the kubectl command listing the block devices and adding them to the YAML file.

Let’s check the storage pool claim.

Finally, we will verify that the cStor storage pool is created and ready for use.

Congratulations! You are now ready to deploy stateful workloads backed by OpenEBS.

In the next part of this tutorial, I will walk you through the steps involved in deploying a highly available instance of PostgreSQL backed by OpenEBS cStor storage engine. Stay tuned!

Janakiram MSV’s Webinar series, “Machine Intelligence and Modern Infrastructure (MI2)” offers informative and insightful sessions covering cutting-edge technologies. Sign up for the upcoming MI2 webinar at http://mi2.live.

Amazon Web Services is a sponsor of The New Stack.

Feature image via Pixabay.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.