Try out the Couchbase Service Broker Locally with Minikube

      +
      Using a local minikube environment, learn how to use the Couchbase Service Broker to deploy a Couchbase cluster and the Couchbase Autonomous Operator.

      Introduction

      In this tutorial you’ll learn how to use the Couchbase Service Broker to deploy instances of Couchbase clusters and the Couchbase Autonomous Operator.

      Before You Begin

      Before you begin this tutorial, you’ll need to set up a few things first:

      • Install the latest Docker Desktop release for your current platform. You’ll need this installed and running in order to install minikube.

        • Make sure to set Docker resource settings to have at least 8 GB (8192 Mi) of memory.

      • Install the latest kubectl for your current platform. If kubectl is already installed, it gets configured to access the Kubernetes cluster control plane inside minikube when the minikube start command is executed.

        • Alternatively, if kubectl is not installed locally, you can use the version of kubectl included with minikube (after it is installed) by aliasing it as follows:

          alias kubectl="minikube kubectl --"
      • Install the latest Service Catalog CLI for your current platform.

      • Install the latest Helm release for your current platform. You’ll be using this to install some necessary dependencies.

      • Install the latest minikube for your current platform.

      Create a Local Kubernetes Cluster

      With Docker running, create a Kubernetes cluster using minikube.

      $ minikube start --cpus 2 --memory 8192

      If you encounter error about not having enough memory, make sure that you’ve set Docker resources to at least 8 GB of memory.

      Install the Service Catalog

      Now that you have a single-node Kubernetes cluster running on your computer, it’s time to install the service catalog using Helm.

      Start by adding the service-catalog Helm repository:

      $ helm repo add svc-cat https://kubernetes-sigs.github.io/service-catalog

      You can verify the installation with the following command:

      $ helm search repo service-catalog
      NAME                	CHART VERSION	APP VERSION	DESCRIPTION
      svc-cat/catalog     	0.3.1        	           	service-catalog webhook server and controller-m...
      svc-cat/catalog-v0.2	0.2.3        	           	service-catalog API server and controller-manag...

      Now that the chart repository has been added, it’s time to install the chart.

      $ helm install catalog svc-cat/catalog --namespace catalog --create-namespace

      Download and Install Service Broker Dependencies

      Before you can proceed with rest of the steps in this guide, you’ll need to download the necessary packages from couchbase.com/downloads.

      Please download the following packages:

      • Couchbase Service Broker 1.1

      • Couchbase Autonomous Operator 2.2

      Both of these packages contain YAML configuration files and command-line tools that you will use to install the Couchbase Service Broker and Couchbase Clusters.

      Make sure to unpack these packages on the same computer where you normally run kubectl.

      Install cbopcfg

      The Couchbase Autonomous Operator package includes a command-line tool named cbsbctl, which is used to install certain dependencies for the Autonomous Operator. Use the steps below to install cbopcfg on your platform of choice.

      • macOS

      • Linux

      • Windows

      1. Open a Terminal window and go to the directory where the cbopcfg binary is located:

        $ cd couchbase-autonomous-operator-kubernetes_x.x.x-macos_x86_64/bin/
      2. Make the cbopcfg binary executable:

        $ chmod +x ./cbopcfg
      3. Move the binary into your PATH:

        $ sudo mv ./cbopcfg /usr/local/bin/cbopcfg
      1. Open a command prompt and go to the directory where the cbopcfg binary is located:

        $ cd couchbase-autonomous-operator-kubernetes_x.x.x-linux_x86_64/bin/
      2. Make the cbopcfg binary executable:

        $ chmod +x ./cbopcfg
      3. Move the binary into your PATH:

        $ sudo mv ./cbopcfg /usr/local/bin/cbopcfg
      1. Open a command prompt and go to the directory where the cbopcfg binary is located:

        $ cd couchbase-autonomous-operator-kubernetes_x.x.x-windows_x86_64\bin\
      2. Add the cbopcfg binary into your PATH.

      Install the Autonomous Operator CRDs and Dynamic Admission Controller

      The included service plans deploy instances of the Autonomous Operator, which has its own dependencies.

      From the unpacked Autonomous Operator directory, run the following command to install the Autonomous Operator CRD:

      $ kubectl create -f crd.yaml

      Next, run the following command to install the dynamic admission controller (DAC) into the default namespace.

      $ cbopcfg create admission

      Install cbcsctl

      The Couchbase Service Broker package includes a command-line tool named cbsbctl, which is used during installation. Use the steps below to install cbsbctl on your platform of choice.

      • macOS

      • Linux

      • Windows

      1. Open a Terminal window and go to the directory where the cbsbctl binary is located:

        $ cd couchbase-service-broker-kubernetes/
      2. Make the cbsbctl binary executable:

        $ chmod +x ./cbsbctl.darwin
      3. Move the binary into your PATH:

        $ sudo mv ./cbsbctl /usr/local/bin/cbsbctl
      1. Open a command prompt and go to the directory where the cbsbctl binary is located:

        $ cd couchbase-service-broker-kubernetes/
      2. Make the cbsbctl binary executable:

        $ chmod +x ./cbsbctl
      3. Move the binary into your PATH:

        $ sudo mv ./cbsbctl /usr/local/bin/cbsbctl
      1. Open a command prompt and go to the directory where the cbsbctl binary is located:

        $ cd couchbase-service-broker-kubernetes\
      2. Add the cbsbctl.exe binary into your PATH.

      Install the Service Broker CRD

      The Service Broker is configured using a Kubernetes custom resource that allows type checking of your configurations. In order to use this custom resource, you must install the custom resource definition (CRD) that is included in the Service Broker package download.

      From the unpacked Service Broker directory:

      $ kubectl create -f crd.yaml

      Install the Service Broker

      The Service Broker can be installed at the namespace level or the cluster level. For the purposes of this tutorial, we’ll be installing the Service Broker at the cluster level.

      From the unpacked Service Broker directory:

      $ ./cbsbctl create clusterservicebroker --profile demo

      You can run the following command to check the status of the Service Broker:

      $ kubectl get deployments
      NAME                          	 	READY   	UP-TO-DATE   AVAILABLE   	AGE
      couchbase-operator-admission   		 1/1     		1             1        	37m
      couchbase-service-broker       		 1/1     		1            	1         32m

      Provision the Couchbase Cluster Service

      The following command deploys a three-node cluster (by default), with a Bucket, and an Administrator user with a password.

      $ svcat provision csb --class cao-2.2-service --plan csb-basic --param password=password --wait

      Bind to the Provisioned Service

      $ svcat bind csb
      Name:        csb
          Namespace:   default
          Status:
          Secret:      csb
          Instance:    csb
      
        Parameters:
          No parameters defined

      This will create a user and allow access to the bucket. Connection string, username, password, and CA certificate will be in the secret, ready to be used by a client of some variety.

      $ kubectl get secrets csb
      NAME   TYPE     DATA   AGE
      csb    	Opaque       5      7m58s

      To access the Couchbase Web Console:

      $ kubectl port-forward couchbase-instance-winhhoku-0000 8091

      Go to http://localhost:8091 and login with the credentials used when provisioning the Couchbase cluster service.