Install the Operator on Kubernetes
This guide walks through the recommended procedure for installing the Couchbase Autonomous Operator on an open source Kubernetes cluster that has RBAC enabled.
If you are looking to upgrade an existing installation of the Operator, see Upgrading the Autonomous Operator.
Download the Operator package and unpack it on the same computer where you normally run
The Operator package contains YAML configuration files and command-line tools that you will use to install the Operator.
After you unpack the download, the resulting directory will be titled something like
All commands in this guide are run as a system administrator account; they require the creation of cluster scoped resources or the granting of roles to service accounts (privilege escalation).
The first step in installing the Operator is to install the custom resource definitions (CRD) that describe the Couchbase resource types. This can be achieved with the following command:
$ kubectl create -f crd.yaml
The operator is composed of two components; a per-cluster dynamic admission controller (DAC) and a per-namespace Operator. Refer to the operator architecture document for additional information on what is required and security considerations.
The following command will install both the DAC and the Operator into the
$ bin/cbopcfg generate admission | kubectl create -f - $ bin/cbopcfg generate operator | kubectl create -f -
Alternatively, you may wish to install just the DAC in the
$ bin/cbopcfg generate admission --namespace camelot | kubectl create -f -
And then install just the Operator into the
$ bin/cbopcfg generate operator --namespace asgard | kubectl create -f -
For further installation options please see the cbopcfg reference manual.
You can use the following command to check on the status of the deployments:
$ kubectl get deployments NAME READY UP-TO-DATE AVAILABLE AGE couchbase-operator 1/1 1 1 8s couchbase-operator-admission 1/1 1 1 8s
The Operator is ready to deploy
CouchbaseCluster resources when both the DAC and Operator deployments are fully ready and available.
In the latest versions of Kubernetes (
kubectl 1.18 or higher), you can perform a dry run create command to validate the DAC is functioning correctly:
$ kubectl create --dry-run=server -f - <<EOF apiVersion: couchbase.com/v2 kind: CouchbaseBucket metadata: name: test EOF couchbasebucket.couchbase.com/test created (server dry run)
The previous command depends on the DAC to provide defaulting for resource attributes, this in turn allows the resource to pass schema validation.
If the DAC is not installed or not functioning, you can expect an error such as:
The CouchbaseBucket "test" is invalid: spec: Required value
Uninstalling the DAC and Operator is the reverse of the installation process:
If you are performing an uninstall in order to upgrade the Operator to a newer version, do not delete the CRDs as this is only relevant for a full uninstall. Failure to do so will result in the deletion of all Couchbase clusters.
$ bin/cbopcfg generate operator | kubectl delete -f - $ bin/cbopcfg generate admission | kubectl delete -f - $ kubectl delete -f crd.yaml