Cassandra operator
Project status: pre-alpha
Major planned features have yet to be completed and API changes are currently planned, we reserve the right to address bugs and API changes in a backwards incompatible way before the project is declared stable. See upgrade guide for safe upgrade process.
Currently user facing Cassandra cluster objects are created as Kubernetes Custom Resources, however, taking advantage of User Aggregated API Servers to improve reliability, validation and versioning may be undertaken. The use of Aggregated API should be minimally disruptive to existing users but may change what Kubernetes objects are created or how users deploy the operator.
We expect to consider the Cassandra operator stable soon; backwards incompatible changes will not be made once the project reaches stability.
Overview
The Cassandra operator manages Cassandra clusters deployed to Kubernetes and automates tasks related to operating an Cassandra cluster.
- Install
- Create and destroy
- Resize
- Recover a node - TODO
- Backup and restore a cluster - TODO
- Rolling upgrade - TODO
- Limitations
There are more spec examples on setting up clusters with backup, restore, and other configurations.
Read Best Practices for more information on how to better use Cassandra operator.
Read RBAC docs for how to setup RBAC rules for Cassandra operator if RBAC is in place.
Read Developer Guide for setting up development environment if you want to contribute.
See the Resources and Labels doc for an overview of the resources created by the Cassandra-operator.
Requirements
- Kubernetes 1.8+
- Cassandra 3.11+
Deploy Cassandra operator
See instructions on how to install/uninstall Cassandra operator .
Create and destroy an Cassandra cluster
$ kubectl create -f example/common/test.yaml
A 3 member Cassandra cluster will be created.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
cassandra-operator7-5d58bc7874-t85dt 1/1 Running 0 18h
test-dc-0 1/1 Running 0 1m
test-dc-1 1/1 Running 0 1m
test-dc-2 1/1 Running 0 1m
See client service for how to access Cassandra clusters created by operator.
Destroy Cassandra cluster:
$ kubectl delete -f example/common/test.yaml
Resize an Cassandra cluster
Create an Cassandra cluster, if you haven't already:
$ kubectl apply -f example/common/test.yaml
In example/common/test.yaml
the initial cluster size is 3.
Modify the file and change replicas
from 3 to 5.
apiVersion: stable.instaclustr.com/v1
kind: CassandraDataCenter
metadata:
name: test-dc
spec:
replicas: 5
image: "gcr.io/cassandra-operator/cassandra:latest"
Apply the size change to the cluster CR:
$ kubectl apply -f example/common/test.yaml
The Cassandra cluster will scale to 5 members (5 pods):
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
test-dc-0 1/1 Running 0 1m
test-dc-1 1/1 Running 0 1m
test-dc-2 1/1 Running 0 1m
test-dc-3 1/1 Running 0 1m
test-dc-4 1/1 Running 0 1m
Similarly we can decrease the size of cluster from 5 back to 3 by changing the size field again and reapplying the change.
apiVersion: stable.instaclustr.com/v1
kind: CassandraDataCenter
metadata:
name: test-dc
spec:
replicas: 3
image: "gcr.io/cassandra-operator/cassandra:latest"
Then apply the changes
$ kubectl apply -f example/common/test.yaml
Limitations
- This operator is currently a work in progress and breaking changes are landing in master all the time until we reach our initial release. Here be dragons!
- The operator does not currently manage backups, a command line backup utility is included, tested and built, but not yet managed by the operator.
- Do not use this in production.