Using a local minikube environment, learn how to use the Couchbase Service Broker to deploy a Couchbase cluster and the Couchbase Autonomous Operator.
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 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 theminikube start
command is executed.-
Alternatively, if
kubectl
is not installed locally, you can use the version ofkubectl
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.
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.
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
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 {service-broker-version-minor}
-
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.
Important
|
Make sure to unpack these packages on the same computer where you normally run kubectl .
|
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.
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
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.
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
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
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
$ 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.