Tag Archives: azure

Kubernetes Cluster on Azure and Expose Couchbase Service

Kubernetes Logo

This blog is part of a multi-part blog series that shows how to run your applications on Kubernetes. It will use the Couchbase, an open source NoSQL distributed document database, as the  Docker container.

  • Part 1 explained how to start Kubernetes cluster using Vagrant – Kubernetes on Vagrant
  • Part 2 did the same for Amazon Web Services – Kubernetes on Amazon Web Services
  • Part 3 did the same for Google Cloud – Kubernetes on Google Cloud

This fourth part will show:

  • How to setup and start the Kubernetes cluster on Azure
  • Run Docker container in the Kubernetes cluster
  • Expose Pod on Kubernetes as Service
  • Shutdown the cluster

azure-kubernetes-couchbase-cluster

Many thanks to @colemickens  for helping me through this recipe. This blog content is heavily based upon the instructions at colemickens.github.io/docs/getting-started-guides/azure/.

Install and Configure Azure CLI

Azure CLI is a command-line interface to develop, deploy and manage Azure applications. This is needed in order to install Kubernetes cluster on Azure.

  1. Install Node:
  2. Install Azure CLI:
  3. Sign up for free trial at https://azure.microsoft.com/en-us/free/.
  4. Login to Azure using the command azure login:
  5. Get account information using azure account show command:

    Note the value shown instead of XXX and YYY. These will be used to configure the Kubernetes cluster.

Start Kubernetes Cluster

  1. Download Kubernetes 1.2.4 and extract it.
  2. Kubernetes cluster on Azure can be started as:

    Make sure to specify the appropriate values for XXX and YYY from the previous command. AZURE_SUBSCRIPTION_ID and AZURE_TENANT_ID are specific to Azure.

    These values can also be edited in cluster/azure/config-default.sh.

  3. Start Kubernetes cluster:

    It starts four nodes of Standard_A1 size. Each node gives you 1 core, 1.75 GB RAM, and 40GB HDD.

Run Docker Container in Kubernetes Cluster on Azure

Now that the cluster is up and running, get a list of all the nodes:

Four instances are created as shown – one for master node and three for worker nodes.

Azure Portal shows all the created artifacts in the Resource Group:

azure-portal-kubernetes-resource-group

More details about the created nodes is available:

azure-portal-kubernetes-vnet

Create a Couchbase pod:

Notice, how the image name can be specified on the CLI. Kubernetes pre-1.2 versions created a Replication Controller with this command. This is explained in  Kubernetes on Amazon Web Services or Kubernetes on Google Cloud. Kubernetes 1.2 introduced Deployments and so this creates a Deployment instead. This enables simplified application deployment and management including versioning, multiple simultaneous rollouts, aggregating status across all pods, maintaining application availability and rollback.

The pod uses arungupta/couchbase Docker image that provides a pre-configured Couchbase server. Any Docker image can be specified here.

Status of the pod can be watched:

Get more details about the pod:

Expose Pod on Kubernetes as Service

Now that our pod is running, how do I access the Couchbase server? You need to expose the Deployment as a Service outside the Kubernetes cluster.

Typically, this will be exposed using the command:

But Azure does not support --type=LoadBalancer at this time. This feature is being worked upon and will hopefully be available in the near future. So in the meanwhile, we’ll expose the Service as:

Now proxy to this Service using kubectl proxy command:

And now this exposed Service is accessible at http://127.0.0.1:9999/api/v1/proxy/namespaces/default/services/couchbase/index.html. This shows the login screen of Couchbase Web Console:

azure-kubernetes-couchbase-web-console

Shutdown Kubernetes Cluster

Finally, shutdown the cluster using cluster/kube-down.sh script.

This script shuts down the cluster but the Azure resource group need to be explicitly removed. This can be done by selecting the Resource Group from portal.azure.com:

azure-portal-kubernetes-delete-resource-group

This is filed as #26601.

Enjoy!

Further references …

  • Couchbase Server Developer Portal
  • Couchbase on Containers
  • Questions on StackOverflow, Forums or Slack Channel
  • Follow us @couchbasedev
  • Couchbase 4.5 Beta

Source: http://blog.couchbase.com/2016/june/kubernetes-cluster-azure-couchbase-service

Couchbase Cloud Recipes – Pick your favorite!

Couchbase 4.x Quick Installation provide instructions to install Couchbase on your local machine.

Would you like to run Couchbase 4.x in cloud? There are plenty of recipes available!

Couchbase Cloud Recipes

Looking for detailed instructions on Couchbase Cloud Recipes?

  • Digital Ocean
  • Jelastic
  • OpenShift
  • Docker
  • BigStep
  • Vagrant
  • Kubernetes
  • Joyent Triton
  • Amazon Web Services
  • Microsoft Azure
  • CoreOS and Kubernetes

Read more about it in Couchbase Cloud Deployments. Are there any other cloud/hosting solution where you you would like to see Couchbase running? Did I miss one where Couchbase already runs?

How is your experience of running Couchbase in the cloud?

Couchbase partners provide a complete list of partners.

As always, talk to us using StackOverflow or Forums.