CouchBase on GKE

GKE Enable API gcloud services enable container.googleapis.com Set Variable export PROJECT_ID=$(gcloud config get-value project) Create GKE Cluster gcloud container clusters create gke-couchbase \ --zone us-central1-a Connect to the cluster gcloud container clusters get-credentials gke-couchbase \ --region us-central1 \ --project=$PROJECT_ID Couchbase Install the Operator https://docs.couchbase.com/operator/current/install-kubernetes.html download package curl -LO https://packages.couchbase.com/couchbase-operator/2.5.0/couchbase-autonomous-operator_2.5.0-kubernetes-linux-amd64.tar.gz tar -xvf couchbase-autonomous-operator_2.5.0-kubernetes-linux-amd64.tar.gz cd couchbase-autonomous-operator_2.5.0-180-kubernetes-linux-amd64 Apply the custom resource definition kubectl apply -f crd.yaml Enable dynamic admission controller bin/cao create admission bin/cao create operator Create Cluster https://docs.

Table Of Contents

GKE

Enable API

gcloud services enable container.googleapis.com

Set Variable

export PROJECT_ID=$(gcloud config get-value project)

Create GKE Cluster

gcloud container clusters create gke-couchbase \
    --zone us-central1-a

Connect to the cluster

gcloud container clusters get-credentials gke-couchbase    
	--region us-central1    
	--project=$PROJECT_ID

Couchbase

Install the Operator

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

download package

curl -LO https://packages.couchbase.com/couchbase-operator/2.5.0/couchbase-autonomous-operator_2.5.0-kubernetes-linux-amd64.tar.gz
tar -xvf couchbase-autonomous-operator_2.5.0-kubernetes-linux-amd64.tar.gz
cd couchbase-autonomous-operator_2.5.0-180-kubernetes-linux-amd64

Apply the custom resource definition

kubectl apply -f crd.yaml

Enable dynamic admission controller

bin/cao create admission
bin/cao create operator

Create Cluster

https://docs.couchbase.com/operator/current/howto-couchbase-create.html

cat > ./couchbase-cluster.yaml << EOF
apiVersion: v1
kind: Secret
metadata:
  name: cb-example-auth
type: Opaque
data:
  username: QWRtaW5pc3RyYXRvcg==  # Administrator
  password: cGFzc3dvcmQ=          # password
---
apiVersion: couchbase.com/v2
kind: CouchbaseBucket
metadata:
  name: default  
spec:
  memoryQuota: 128Mi
---
apiVersion: couchbase.com/v2
kind: CouchbaseCluster
metadata:
  name: cb-example  
spec:
  image: couchbase/server:7.2.0  
  security:
    adminSecret: cb-example-auth
  networking:
    exposeAdminConsole: true
    adminConsoleServices:
    - data
  buckets:
    managed: true
  servers:
  - size: 3  
    name: all_services
    services:
    - data
    - index
    - query
    - search
    - eventing
    - analytics
EOF

Apply

kubectl apply -f couchbase-cluster.yaml
kubectl get pods

Access

kubectl port-forward cb-example-0000 8091

Open web preview Change port to 8091 Access UI with the user/pass in the yaml: username: QWRtaW5pc3RyYXRvcg== # Administrator password: cGFzc3dvcmQ= # password

Administrator password