What’s Helm?

Helm is a tool that streamlines the installation and management of applications on Kubernetes platforms. The Couchbase Autonomous Operator helm chart allows users to combine Kubernetes definitions for resources like Services, Roles, and Deployments into a single customizable package.  Since Helm is essentially a package manager for Kubernetes applications, all installed resources can be managed and updated as a single unit using an all-or-nothing approach which ensures every dependency needed for each release is successfully installed when upgrading. This blog describes how to use Helm for installing the Couchbase Autonomous Operator along with a Couchbase Cluster into your Kubernetes environment.

 

Installing Helm

Assuming you have a kubernetes cluster running on at least version 1.11, then you’re all set to get started with helm for deploying a Couchbase Cluster.  The first step is to install the Helm command line client. The following commands will download and unpack the helm binary to an executable path for linux (for a different OS see releases)

Now let’s install Helms templating service which is called tiller. Tiller does all the work of interacting directly with the Kubernetes API for creating resources like Services, Secrets, and Pods.  As with every good quick-start guide, we’re going to be a bit loose with security for the sake of brevity, which means giving the tiller service the ability to create resources within any Kubernetes namespace.  Run the following command to create the RBAC rules and ServiceAccount needed for the Tiller service:

Finally install the tiller service into the kubernetes cluster:

Time to start helming!

Installing Charts

Install the Operator Chart

The Couchbase Operator Chart deploys the dynamic admission controller, the Operator itself, and every resource needed to run them within your cluster.  This is the power/magic of helm, as it functions very similar to a package manager by representing a group of resources as a single installable, and upgradeable unit.

To install the charts you will need to point the helm client to our partner repository with the following command:

And now let’s install the operator chart:

The install returns a list of commands to run for checking logs of the operator.  

Copy the first command to ensure that the operator has started successfully:

And you should see that the operator is listening for events, which means that it’s waiting for a cluster to manage:

 

Install the Couchbase Cluster Chart

The couchbase cluster chart provides a templated version of the couchbase cluster type.  By default, this chart will install a 3 node cluster. If you’re curious about the details of this chart you can view the default values with the following command:

Now let’s get a cluster running by installing the cluster chart with the following command:

The install returns steps to get status of the cluster along with a quick way to view the Admin console. 

 Let’s run the 2nd command to view the console:

This command will create a proxy of the Admin console to your localhost at port 8091. Navigate to http://localhost:8091 to view the cluster.  If you do not yet see the cluster, run kubectl describe po cb-example-couchbase-cluster-0000  to get status of the Pod being forwarded because it may be that images are still being created, which is often the case when running on a brand new cluster.

Managing Charts

At this point you should have at least two charts installed, one for the operator and another for the cluster.  To view the list of installed charts run helm list:

When a chart is installed it is referred to by Helm as a release. You can install multiple releases from a single chart. When a release is deleted using helm delete, all of it’s packaged resources (Pods, Services, Secrets) are also deleted.  For more information about customizing the operator and cluster chart, refer to the Couchbase Operator documentation on Updating a Release.

Installing with TLS and Persistent Volumes

To create a cluster with TLS and Persistent Volumes we’ll use helm’s template overriding to provide customizations of the cluster chart.

Create a file named myvalues.yaml with the following values:

The above values assume you have a storage class named default, if this is not the case then change it to the appropriate value for your environment.  Now install the cluster chart with the value overrides:

Notice helm auto-generated the CA cert used by the operator and clients along with the server cert and key.

To view the Admin console, run the port forward command from the TLS enabled admin port (18091) of a pod to your localhost with the following command:

Navigate to http://localhost:18091 to view the cluster.

Moving on

If you’re thinking, “that was too easy,” you’re probably right.  If you’re thinking, “I want to know more”, then have a look at the Setup Guide for best practices on taking your environment in to production!

More Couchbase Autonomous Operator Resources

Read More

 

 

 

 

Posted by Tommie McAfee

Contributing developer to the one and only Couchbase Autonomous Operator.

Leave a reply