This repository contains a dashboard application for monitoring and managing the Couchbase Autonomous Operator and Couchbase clusters on Kubernetes.
To compile the dashboard binary, choose the appropriate command for your target platform:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -o dashboard cmd/cod/main.goGOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -installsuffix cgo -o dashboard cmd/cod/main.goAfter compiling the binary, build the Docker image for your target platform:
docker build --platform=linux/amd64 -t cod:latest .docker build --platform=linux/arm64 -t cod:latest .docker buildx build --platform=linux/amd64,linux/arm64 -t cod:latest .Download the CAO tool from: https://www.couchbase.com/content/c/downloads-kubernetes?x=gdjudm
In the CAO tool directory, run:
bin/cao generate operator > operator.yamlYou can also generate the admission controller configuration:
bin/cao generate admission > admission.yamlModify the operator.yaml file to include the COD sidecar. Use the provided operator.yaml as a reference.
See the operator.yaml file in the example folder of this repository for additional guidance on the modifications.
The key modifications include:
- Add pod/log access to the operator role:
apiGroups:
- ""
resources:
- pods
- pods/status
- services
- persistentvolumeclaims
- pods/log # Add this line
verbs:
- get
- list
- watch
- create
- update
- delete
- patch- Add 'watch' permission for events:
apiGroups:
- ""
resources:
- events
verbs:
- list
- create
- update
- watch # Add this line- Add the COD sidecar container to the operator deployment:
- name: cod-sidecar
image: cod:latest
imagePullPolicy: IfNotPresent
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- containerPort: 3000
name: cod
resources: {}- Add the COD port to the service:
- name: cod
port: 3000
protocol: TCPApply the Custom Resource Definitions (CRDs) first:
kubectl apply -f <cao-directory>/crd.yamlThen apply the modified operator and admission configurations:
kubectl apply -f operator.yaml
kubectl apply -f admission.yamlFinally, deploy your Couchbase cluster:
kubectl apply -f <your-couchbase-cluster-config>.yamlTo access the Couchbase UI through the dashboard's reverse proxy, ensure your Couchbase cluster configuration includes the following setting:
apiVersion: couchbase.com/v2
kind: CouchbaseCluster
metadata:
name: your-cluster-name
spec:
networking:
exposeAdminConsole: true
# ... rest of your cluster configurationImportant: The exposeAdminConsole: true setting is required for the dashboard's reverse proxy functionality to work properly. Without this setting, you won't be able to access the Couchbase Web Console through the "Open Couchbase UI" button in the dashboard.
Once everything is up and running, forward the dashboard port:
kubectl port-forward svc/couchbase-operator 3000Access the dashboard at: http://localhost:3000