Couchbase: Setup Distributed Document-oriented NoSQL Database on Kubernetes Cluster - Part 2

Couchbase offers a package that includes several binaries for quickly installing the Couchbase Operator on a Kubernetes Cluster.

Couchbase: Setup Distributed Document-oriented NoSQL Database on Kubernetes Cluster - Part 2
Couchbase

Installing Couchbase Operator on Kubernetes Cluster

Couchbase offers a package that includes several binaries for quickly installing the Couchbase Operator on a Kubernetes Cluster. To obtain this package, visit https://www.couchbase.com/downloads/ and download the package tailored for Kubernetes, as shown in the image below:

Download Couchbase package

Download the package to a desired folder and then extract its contents. This will make the binaries and other necessary files available for installation.

It is recommended to create a dedicated namespace for the Couchbase installation. This approach helps keep the Kubernetes environment organized and makes managing resources related to Couchbase more convenient.

~$ kubectl create namespace couchbase

Create a new file named install.sh and insert the following bash script:

To modify the permissions of the install.sh file and make it executable, run the following command in your terminal:

~$ sudo chmod +x install.sh

~$ ./install.sh

Verify the Couchbase Operator installation

~$ kubectl -n couchbase get deployments

NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
couchbase-operator             1/1     1            1           30s
couchbase-operator-admission   1/1     1            1           30s

Awesome! With the Couchbase Operator installed on your Kubernetes cluster, you can now proceed to deploy a Couchbase Cluster.

Setup Couchbase Cluster on Kubernetes

Alright! The package you've downloaded earlier contains a configuration file that can be used to set up the Couchbase Cluster. Just make a few adjustments to this file to include backup settings and update the authentication secret if needed, in case you want to use a different username and password.

Install it to Kubernetes

~$ kubectl -n couchbase apply -f couchbase-cluster.yaml

Expose Couchbase Dashboard via Ingress

It's quite handy to access the Couchbase Dashboard from anywhere. To achieve this, we'll create an Ingress resource that exposes the Couchbase Dashboard. To generate an SSL Certificate via Let's Encrypt, we'll need Cert Manager. You can find out how to do this by following the instructions provided in the link below:

How to get Free SSL Certificate for Kubernetes Cluster using Let’s Encrypt
Using SSL is essential for any website that wants to protect its users’ sensitive information. Without SSL, data can be intercepted and stolen by hackers, putting users’ privacy and security at risk.

Create Ingress Resource

Install to Kubernetes

~$ kubectl -n couchbase ingress.yaml

Navigate your browser to https://couchbase-dashboard.example.com

Couchbase Dashboard Login

Log in using the username and password you set earlier (username: admin and password: xxx).

Voilà! Now you have a Couchbase Cluster up and running on your Kubernetes Cluster.

Installing Couchbase on Google Kubernetes Engine

As GKE does not permit communication between the control plane and worker nodes on port 8443, which is the port that Couchbase uses, it's necessary to configure a firewall to allow communication on this port. You can accomplish this using the Terraform script provided below. Alternatively, you can also set up the firewall rule directly through the Google Cloud Console.


About 8grams

We are a small DevOps Consulting Firm that has a mission to empower businesses with modern DevOps practices and technologies, enabling them to achieve digital transformation, improve efficiency, and drive growth.

Ready to transform your IT Operations and Software Development processes? Let's join forces and create innovative solutions that drive your business forward.

Subscribe to our newsletter for cutting-edge DevOps practices, tips, and insights delivered straight to your inbox!