
This shows the travel-sample bucket is created and has 31,591 JSON documents.
**Create Couchbase “worker” Replication Controller**
Now, let’s create a worker replication controller. It can be created using the configuration file:
```
apiVersion: v1
kind: ReplicationController
metadata:
name: couchbase-worker-rc
spec:
replicas: 1
selector:
app: couchbase-worker-pod
template:
metadata:
labels:
app: couchbase-worker-pod
spec:
containers:
- name: couchbase-worker
image: arungupta/couchbase:k8s
env:
- name: TYPE
value: "WORKER"
- name: COUCHBASE\_MASTER
value: "couchbase-master-service"
- name: AUTO\_REBALANCE
value: "false"
ports:
- containerPort: 8091
```
This RC also creates a single replica of Couchbase using the same arungupta/couchbase:k8s image. The key differences here are:
- TYPE environment variable is set to WORKER. This adds a worker Couchbase node to be added to the cluster.
- COUCHBASE\_MASTER environment variable is passed the value of couchbase-master-service. This uses the service discovery mechanism built into Kubernetes for pods in the worker and the master to communicate.
- AUTO\_REBALANCE environment variable is set to false. This ensures that the node is only added to the cluster but the cluster itself is not rebalanced. Rebalancing is required to re-distribute data across multiple nodes of the cluster. This is the recommended way as multiple nodes can be added first, and then cluster can be manually rebalanced using the Web Console.
Let’s create a worker:
```
kubectl create -f cluster-worker.yml
replicationcontroller "couchbase-worker-rc" created
```
Check the RC:
```
kubectl get rc
NAME DESIRED CURRENT AGE
couchbase-master-rc 1 1 6m
couchbase-worker-rc 1 1 22s
```