What is the IBM Cloud Kubernetes Service?
IBM Cloud Kubernetes Service provides a native Kubernetes experience that is secure and easy to use. As a certified K8S provider, IBM Cloud Kubernetes Service provides a wide range of powerful features. These include intelligent scheduling, self-healing, horizontal scaling, service discovery and load balancing. Features also assist with automated rollouts and rollbacks, and secret and configuration management.
IBM Cloud Kubernetes Service is one of the Certified Kubernetes Hosted Platforms under CNCF Certified Kubernetes Offerings.
This blog will explain how to deploy and run Couchbase Autonomous Operator on IBM Cloud Kubernetes Service using Persistent Storage.
Deploying Couchbase Autonomous Operator on IBM Cloud Kubernetes Service
Using Kubernetes Persistent Volumes
Kubernetes persistent volumes offer a way to create Couchbase pods with data that resides outside of the actual pods themselves. This decoupling increases data resilience in the Couchbase cluster when a node goes down or associated pods get terminated.
Likewise, persistent volumes provide greater deployment flexibility and efficiency because Kubernetes automatically moves Couchbase pods between nodes. This can be done without worrying about any downtime or data loss. The Couchbase Autonomous Operator supports some of the most popular Kubernetes persistent volumes, such as GlusterFS, CephRBD, AWS, Azure Disk, GCE, and Portworx.
- You need to get the IBM Cloud account you can follow instructions on Getting started with Kubernetes clusters
- Download the Couchbase Autonomous Operator 1.1 package for your platform
Creating a Kubernetes cluster on IBM Cloud
- Login to https://cloud.ibm.com/ and you will see the IBM Cloud dashboard and one of the tile “Kubernetes clusters”.
- Click “Create a cluster” which will then take you to Kubernetes Service page which has links to documentation and pricing plans.
- On “Create a new cluster” you have multiple choices to make starting with ‘Cluster type’, ‘Resource Group/ Location’, ‘Availability Worker Zone’, ‘Kubernetes version’,’ Instance type’, and ‘Cluster name’.
- After you select the options and hit “Create cluster” Kubernetes Service will now start deploying your cluster. You can check the status of your cluster on the ‘Overview’ tab.
- Once your Kubernetes cluster is fully deployed and status is ready you can then get access to the cluster. You can use the instructions in the ‘Access’ tab to log in to IBM Cloud (https://api.us-east.bluemix.net) and check the status of Kubernetes worker nodes.
- Now you have fully deployed Kubernetes cluster on the IBM Cloud.
Installing the Couchbase Autonomous Operator
- Before creating the Couchbase cluster, you need to first install Couchbase Autonomous Operator on the Kubernetes cluster. For detailed instruction on how to install and prerequisites read Couchbase Autonomous Operator 1.1 documentation. The Couchbase Autonomous Operator configuration is defined below.
- Now run the below commands to ‘Create a Cluster Role’, ‘Create a Service Account’, and ‘Create the Operator’.
- Shortly, the Couchbase Autonomous Operator will be up and running.
Creating the Couchbase cluster with Persistent Storage
- Before creating the Couchbase cluster, create a secret with the secret.yaml file which included in the downloaded package.
- To deploy a Couchbase Server cluster using the Operator, all you have to do is create a CouchbaseCluster configuration file that describes what you want the cluster to look like (e.g. couchbase-version, number of nodes, types of services, storage-class, etc).
- Next, push that configuration file into Kubernetes.
- You can see the deployment, pods, storage, and logs through Kubernetes Dashboard web console.
- The port details for accessing the Couchbase Web Console can be found in the cb-example-ui service found under Services in the left-hand nav. You’ll see a set of Couchbase ports and their corresponding Node Ports. In this example, the Couchbase ports are 8091 (non-SSL) and 18091 (SSL). You can access the Couchbase Web Console on the Node Ports, which in this example are 30306 (non-SSL) and 32347 (SSL). Therefore you would point your browser to <node_ip>:30306, where <node_ip> is the IP address of any Kubernetes worker node that hosts the Couchbase cluster.
- You can now connect to the Couchbase cluster using the credentials saved in the secret. Other application pods can mount and use this secret and communicate with the service.
Auto Recovery with Persistent Volumes
Now that Couchbase cluster is deployed and running on Kubernetes cluster lets run one ‘auto recovery’ scenario. The Couchbase Autonomous Operator is designed to always monitor the Couchbase cluster for failures. When a node or server group failure is detected, the Couchbase Operator is designed to automatically creates a new instance either on the same host machine (preferably) or on a different host machine. It will then rebalance out the bad instances, add the new instance, and bring the cluster back up to full capacity.
If a Couchbase cluster is configured with persistent volumes, the Couchbase Autonomous Operator does the following during an auto recovery event:
- Creates a new instance and attaches it to the same persistent volume
- Performs complex Couchbase operations such as delta-node recovery and warm-up operations, which reduces rebalancing data from all other instances (a time-consuming operation depending on the size of data)
- Removes the faulty instance from the Couchbase cluster and replaces it with a new instance, ensuring that the cluster is back up to the desired configuration without any loss of data
To illustrate the points above, let’s delete the pod cb-example-0002 to see how the cluster behaves.
Hope that this blog has given you a good overall guide for getting started with the Couchbase Autonomous Operator on IBM Cloud Kubernetes Service. Just to recap on what is needed to get started with Couchbase Autonomous Operator on IBM Cloud Kubernetes Service …
- Create an IBM Cloud account
- Login to main IBM Cloud Dashboard
- Create a Kubernetes cluster
- Install Couchbase Autonomous Operator
- Create a Couchbase cluster with Persistent Storage