Debug School

Cover image for Install Couchbase Operator on RedHat OpenShift
Suyash Sambhare
Suyash Sambhare

Posted on

Install Couchbase Operator on RedHat OpenShift

Prerequisites

Log in as RedHat OpenShift System administrator and download the Operator package https://www.couchbase.com/downloads/?family=open-source-kubernetes and unpack it on the same computer where you normally run oc.
The Operator package contains YAML configuration files and command-line tools that you will use to install the Operator.
After unpacking the download, CD into the directory couchbase-autonomous-operator-openshift.2.5-linux_x86_64.

Red Hat requires the use of Red Hat Container Catalog images for OpenShift

$ oc adm policy add-scc-to-user anyuid system:serviceaccount:couchbase-ns:default 
clusterrole.rbac.authorization.k8s.io/system:openshift:scc:anyuid added: "default"
Enter fullscreen mode Exit fullscreen mode

Install the Custom Resource Definitions

Install the custom resource definitions (CRD) that describe the Couchbase resource types.

$ oc create -f crd.yaml
Enter fullscreen mode Exit fullscreen mode

Install the CouchBase Operator

The operator is composed of two components; a per-cluster dynamic admission controller (DAC) and a per-namespace Operator.

Use the cao create admission command to deploy the DAC after installing the Operator.
The DAC and Operator will be installed into the current project/namespace selected by the oc command.

$ oc projects
$ oc create namespace couchbase-ns
namespace/couchbase-ns created
$ oc project couchbase-ns
Enter fullscreen mode Exit fullscreen mode

Deployments should have login credentials that allow access to container images.
Provide these by secret:

$ oc create secret docker-registry rh-catalog --docker-server=registry.connect.redhat.com --docker-username=suyashsambhare --docker-password=********** --docker-email=suyashas@duck.com
Enter fullscreen mode Exit fullscreen mode

Install the DAC and the Operator:

$ bin/cao create admission --image-pull-secret rh-catalog
$ bin/cao create operator --image-pull-secret rh-catalog
Enter fullscreen mode Exit fullscreen mode

Kaveri

Installation in different namespaces:

Create two different namespaces

$ oc project dac-ns
$ oc project couch-ns
Enter fullscreen mode Exit fullscreen mode

Install DAC:

$ oc project dac-ns
$ bin/cao create admission --image-pull-secret rh-catalog
Enter fullscreen mode Exit fullscreen mode

Install CouchBase Operator:

$ oc project couch-ns
$ bin/cao create operator --image-pull-secret rh-catalog
Enter fullscreen mode Exit fullscreen mode

Check the Status

The Operator is ready to deploy Couchbase Cluster resources when both the DAC and Operator deployments are fully ready and available.

$ oc get deployments
NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
couchbase-operator             1/1     1            1           8s
couchbase-operator-admission   1/1     1            1           8s

Enter fullscreen mode Exit fullscreen mode

Install User Permissions

Users will not have permission to create and modify Couchbase custom resources.
Provide a cluster role:

$ oc create -f cluster-role-user.yaml
Enter fullscreen mode Exit fullscreen mode

Associate the role with a user couch-user:

$ oc create rolebinding couch-user-couchbasecluster --namespace dac-ns --user couch-user --clusterrole couchbasecluster
Enter fullscreen mode Exit fullscreen mode

You can now log in as the user couch-user and manage Couchbase resources in the dac-ns namespace.

Uninstalling the Operator

$ bin/cao delete operator
$ bin/cao delete admission
$ oc delete -f crd.yaml

Enter fullscreen mode Exit fullscreen mode

Ref: https://docs.couchbase.com/operator/current/install-openshift.html

Top comments (0)