Cassandra and Kubernetes with K8ssandra

Cassandra is a kick-ass database. It's reliable and works pretty well for insert heavy workloads. Cassandra does well with reads as well as long as you design your tables with your access patterns in mind. In order to work well with Cassandra, you need to avoid Tombstones either by avoiding deletes and updates or by avoiding collections. Cassandra cluster configuration and distribution can be tricky and also repairs can be a challenge at scale. K8ssandra is a complete Cassandra distribution with observability(Grafana and Prometheus) and a simple solution for repairs called Reaper. You also need to keep in mind that by using Cassandra in containers you will lose throughput. Let's say you want to explore Cassandra and you are already using kubernetes or you have a tier 2 or 3 need or even want to save some cost in your development environment that could be an interesting solution. Today I will show how to install K8ssandra in Minikube.

Installing K8ssandra

You will need to have Minikube and helm installed on your machine. Helm is a package manager for kubernetes and works based on a template(similar to Terraform) makes it super easy to install the software in kubernetes. 

Using The Services

So before we use the services we need to perform some port forward. For each command open a new terminal window or tab:

kubectl port-forward service/grafana-service 3000:3000

kubectl port-forward service/prometheus-operated 9090:9090 

kubectl port-forward service/k8ssandra-cluster-a-reaper-k8ssandra-reaper-service 8080:8080

kubectl port-forward service/k8ssandra-dc1-all-pods-service 9049:9042

Traefik http://192.168.99.121:32090/dashboard/#/










Grafana http://localhost:3000/










Prometheus http://localhost:9090/










Cqlsh









All scripts and configs are available at my github here. Have Fun.

Cheers,

Diego Pacheco

Popular posts from this blog

Kafka Streams with Java 15

Rust and Java Interoperability

HMAC in Java