Please refer to this post for the latest version.

The Couchbase Autonomous Operator makes it extremely easy to configure and manage Couchbase Server deployments on kubernetes clusters on public and private clouds. Couchbase Mobile deployments require a Sync Gateway cluster in addition to Couchbase Server clusters. A Sync Gateway cluster typically consisting of two or more Sync Gateway nodes fronted by a Load Balancer responsible for balancing inbound requests from clients.

A Sync Gateway container must be treated like any other Application server container. To that end, the Couchbase operator does not manage the deployment of Sync Gatway cluster. However, the good news is that the deployment and management of Sync Gateway cluster using Kubernetes is extremely straightforward and takes a few steps to get going.

Reference Architecture

This is a reference architecture of a Couchbase Mobile cluster on Kubernetes :

While there is nothing “Couchbase specific” in the deployment of Sync Gateway, we do make the following recommendations

  • Use the Kubernetes Deployment Controller for deploying Sync Gateway containers. Deployment Containers allow you to define replicas and manage rollouts and rollbacks.
  • Use a secret for storing the Sync Gatway Config file. This is important as the Sync Gateway config file holds the RBAC credentials that is used for the Sync Gateway node to connect to Couchbase Server cluster.
  • Configure a Load Balancer with an external IPAddress that Couchbase Lite and other external clients can connect to. A load balancer can only be configured in a cloud environment.

Note that at the present time, Sync Gateway pods must be deployed on the same Kubernetes cluster as Couchbase Server. You can enforce separation of concerns and avoid resource contention by configuring the nodes that would run Couchbase Server or Sync Gateway pods, through namespaces, by specifying strict resource usage limits and configurating network access rules to control traffic between Couchbase Server and Sync Gateway cluster.

Tutorial

We have put together a step-by-step tutorial of how to deploy and manage a Sync Gateway cluster on Kubernetes. The tutorial also includes relevant .yaml files for configuring the Sync gateway cluster and Load Balancer.

The instructions in the tutorial apply to any Kubernetes enviornment. The differences that you will encounter between the managed environments will primarily be in the use of platform specific command line tools, in the console UI and in the configuration of RBAC. For instance, you would use gcloud on Google Kubernetes Engine (GKE), Azure CLI on Azure Container Service (AKS) and AWS IAM Authenticator for Kubernetes for Amazon Elastic Container Service(EKS). The instructions on how RBAC is setup is also platform specific. However, these platform specific variations have no bearing on the Sync Gateway deployment instructions.

Here are the direct links for setting up Couchbase server cluster on popular managed Kubernetes environments. Once the Couchbase Server is deployed, follow the steps in Sync Gateway tutorial to deploy the Sync Gateway cluster.

  • Instructions for setting up Couchbase Server cluster with Amazon Elastic Container Service for Kubernetes (EKS) on Amazon Web Services (AWS) is outlined in this tutorial
  • Instructions for setting up Couchbase Server cluster with Azure Container Service (AKS) on Azure Cloud Platform is outlined in this blog post
  • Instructions for setting up Couchbase Server cluster Google Kubernetes Engine (GKE) on Google Cloud Platform (GCP) will be coming soon.

What Next

As you probably gathered from the tutorial, it only takes a couple of steps to deploy your Sync Gateway containers using Kubernetes.

If you have questions or feedback, please leave a comment below or feel free to reach out to me at Twitter @rajagp or email me priya.rajagopal@couchbase.com.  The Couchbase Forums are another good place to reach out with questions.

Acknowledgements

I would like to thank Matt Carabine and James Nocentini for their feedback and support towards the development of the tutorial.

 

Author

Posted by Priya Rajagopal, Director, Product Management

Priya Rajagopal is a Director of Product Management at Couchbase responsible for the product portfolio for mobile and edge computing. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.

Leave a reply