A newer version of this documentation is available.

View Latest

Cluster Deployment Tutorial


    This tutorial walks you through the steps to deploy a three-node cluster with pre-loaded data.

    This tutorial assumes the following:
    • You have a working knowledge of Kubernetes

    • You have deployed the Operator and it is up and running

    • You have reviewed the prerequisites and prepared your Kubernetes or OpenShift cluster to run Couchbase pods

    • You have administrative privileges for the Kubernetes or OpenShift cluster

    • You have downloaded the Operator package

      The Operator package also contains YAML configuration files that you will use in this guide.

      After you unpack the download, the resulting directory will be titled something like couchbase-autonomous-operator-kubernetes_x.x.x-linux_x86_64. Make sure to cd into this directory before you run the commands in this guide.

    Ensure that your Kubernetes environment has the appropriate resources for the Couchbase cluster that you’re trying to deploy.

    In the case of Minikube and Minishift, the default memory allocation is 2 GB. This is not sufficient for running a three-node Couchbase cluster like the one in the example configuration used in this guide. If you’re using the example configuration for demo purposes, you should set the memory allocation to 4 GB at a minimum (8 GB recommended). You should also increase the CPU allocation if you experience poor performance.

    You can set the recommended memory and CPU allocation when you start Minikube or Minishift:

    minikube start --cpus 2 --memory 8192
    minishift start --cpus 2 --memory 8192

    Create a Couchbase Cluster

    • Kubernetes

    • OpenShift

    kubectl apply -f  couchbase-cluster.yaml
    oc apply -f  couchbase-cluster.yaml

    Loading data

    Use the sample pillowfight job to load items into your cluster. The following spec loads 10k items into the Couchbase cluster:

    apiVersion: batch/v1
    kind: Job
      name: pillowfight
          name: pillowfight
          - name: pillowfight
            image: couchbaseutils/pillowfight:v2.9.3
            command: ["cbc-pillowfight",
                      "-U", "couchbase://cb-example-0000.cb-example.default.svc/default?select_bucket=true",
                      "-I", "10000", "-B", "1000", "-c", "10", "-t", "1", "-u", "Administrator", "-P", "password"]
          restartPolicy: Never

    If you’re not using the default namespace, you must update the pillowfight-data-loader.yaml file to reflect your namespace. For example, if your namespace is myproject, edit the command field in the YAML file to replace cb-example-0000.cb-example.default.svc with cb-example-0000.cb-example.myproject.svc. The updated field will now look like the following snippet:

    command: ["cbc-pillowfight",
                      "-U", "couchbase://cb-example-0000.cb-example.myproject.svc/default?select_bucket=true",
                      "-I", "10000", "-B", "1000", "-c", "10", "-t", "1", "-u", "Administrator", "-P", "password"]

    To deploy the pillowfight data loader, run the following command:

    • Kubernetes

    • OpenShift

    kubectl create -f pillowfight-data-loader.yaml
    oc create -f pillowfight-data-loader-openshift.yaml

    Once it completes, you should have 10k items loaded into your cluster.