The Couchbase Autonomous Operator configuration is defined below. When loaded into Kubernetes, it downloads the Operator Docker image, creates the CouchbaseCluster custom resource definition (CRD), and starts listening for CouchbaseCluster events. The Operator uses a deployment so that it can restart if the pod it’s running in dies.
|Most of the fields in the Operator configuration should never be changed and it is recommended that you use the configuration as is. However, there are some exceptions noted below.|
apiVersion: apps/v1 kind: Deployment metadata: name: couchbase-operator namespace: default spec: replicas: 1 template: metadata: labels: name: couchbase-operator spec: containers: - name: couchbase-operator image: couchbase/operator:1.1.0 command: - couchbase-operator args: - -create-crd env: - name: MY_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name ports: - name: readiness-port containerPort: 8080 readinessProbe: httpGet: path: /readyz port: readiness-port initialDelaySeconds: 3 periodSeconds: 3 failureThreshold: 19 serviceAccountName: couchbase-operator
The Operator manages clusters in the namespace that it’s deployed in. If you want to deploy the Operator in a namespace other than the default namespace, then change the
You shouldn’t need to change the Operator image unless you are pulling the image from somewhere other than the official Couchbase Docker repository. If you are pulling the image from somewhere else, change the
By default, the name of the deployment that is created to maintain the Operator is called
couchbase-operator. It is recommended that you use this name since it is used in all of the examples and tutorials in the Operator documentation. If you need to change it for some reason, ensure that you change the
spec.spec.containers.name fields. These fields must all have the same value.
It is recommended that you use a service account named
couchbase-operator, but depending on your environment you may want to use a service account with a different name. Note that this field only takes effect if your Kubernetes environment has RBAC enabled.
Normally deployments are used to create multiple instances of a pod in order to provide redundancy. However, when deploying the Operator, you should always set replicas to
1. This is because the Operator pod uses leader election to ensure that only one Operator is running in a specific namespace. If you start more than one Operator pod in the same namespace, only the first one will start successfully. The Operator uses deployments so that if the Operator dies, a new Operator pod gets created and picks up from where the old one left off.