RethinkDB Cluster for Kubernetes
MIT Licensed by Ross Kukulinski @RossKukulinski
This repository contains Kubernetes configurations to easily deploy RethinkDB.
The quickstart provides a non-persistent disk configuration for development
and testing. There is also a GKE / GCE configuration which supports
persistent volume backed replicas.
By default, all RethinkDB Replicas are configured with Resource Limits and Requests for:
- 256Mi memory
- 100m cpu
In addition, RethinkDB Replicas are configured with a 100Mi cache-size. All
of these settings can be tuned for your specific needs.
This is based on the original work in github.com/kubernetes/kubernetes, but has been adapted to utilize newer versions of RethinkDB (2.3+) as well as supporting proxies.
Docker Automated Build: rosskukulinski/rethinkdb-kubernetes:2.3.5
It's important to note that the default admin interface IS exposed via public LoadBalancer. This is for demonstration purposes only. I would recommend changing the admin service to
type: ClusterIP and use a TLS & password protected proxy (like nginx) to publicly expose the admin interface.
New to Kubernetes?
- Create a project on https://console.cloud.google.com
gcloudto your project
gcloud config set <project-name>
- Create a cluster via the Console: Compute > Container Engine > Container Clusters > New container cluster.
Leaving all other options default - You should get a Kubernetes cluster with three nodes, ready to receive your container image.
gcloudto point to your container -
gcloud container clusters get-credentials --zone <cluster-zone> <cluster-name>
Quickstart without persistent storage
Launch Services and Deployments
kubectl create -f rethinkdb-quickstart.yml
Once Rethinkdb pods are running, access the Admin service
kubectl describe service rethinkdb-admin
To find the external IP to connect to, locate at the
EXTERNAL-IP column under the
rethinkdb-driver row after running
kubectl get service
Scale up the number of Rethinkdb replicas
kubectl scale deployment/rethinkdb-replica --replicas=5
Observe your pods
kubectl get pods
GKE/GCE Configuration with persistent storage (recommended)
Due to the way persistent volumes are handled in Kubernetes, we have to have one RC per replica, each with its own persistent volume. The RC is used to create a new pod should there be any issues.
This assumes you have created three persistent volumes in GKE:
Create the RethinkDB Services and first replica
kubectl create -f rethinkdb-services.yml kubectl create -f rethinkdb-replica.1.yml
Wait for first replica to come up before launching the other replicas
kubectl create -f rethinkdb-replica.2.yml kubectl create -f rethinkdb-replica.3.yml kubectl create -f rethinkdb-proxy.yml kubectl create -f rethinkdb-admin.yml