This post is part of a Learning Series that shows you how to successfully run Apache Cassandra® in Kubernetes. Each workshop in this series will help you level up a new skill and introduce you to all the concepts you need to pass the K8ssandra Certification Exam.
With the adoption of Cassandra on Kubernetes skyrocketing, this Apache Cassandra Operations In Kubernetes Learning Series gives you the skills you need to keep up with the demand for cloud-native apps deployed on a highly scalable NoSQL database.
Plus, once you’ve completed the series, you can request a free voucher to take the K8ssandra certification exam. An official certification is the best way to gain a leg up in your career, command a higher salary, and begin mastering the powerful database behind leading enterprises including Apple, Instagram, Netflix, Sky, Spotify, TikTok, Uber, and more.
To prepare you for the exam, this first workshop introduces you to the technologies involved in deploying a cloud-native application with Cassandra in Kubernetes. In the process, you’ll learn how to use the following:
- K8ssandra to run the sample app in Kubernetes
- Prometheus to collect system metrics
- Grafana to monitor the Cassandra database
- Reaper to manage Cassandra data replica consistency
- Stargate APIs to easily interact with Cassandra
At the end of this post, you can move onto the hands-on exercise where you’ll go through each step of the workshop within an interactive training environment.
Ready?
Understanding the technologies
To put you on the fast track, here’s a brief overview of the technologies covered in this workshop and what they’re used for.
K8ssandra
Apache Cassandra is a robust, easily-scalable database that’s ideal for cloud-native apps, which makes it a natural fit for Kubernetes — an orchestration platform for deploying and managing containerized systems in the cloud.
The problem is that Cassandra can be challenging to install, configure, monitor, and manage on Kubernetes without help. This is where a different kind of open-source project comes in.
K8ssandra provides a production-ready platform for running Apache Cassandra on Kubernetes. It also installs several other useful tools to create a developer-friendly ecosystem that simplifies (and automates) repairs, backups, and monitoring.
In the upcoming Katacoda scenario, you’ll deploy the example app in Kubernetes using K8ssandra to see just how easy it is. But first, let’s take a quick look at some of the tools K8ssandra offers to help you build scalable, cloud-native apps.
Helm
Helm is a package manager for Kubernetes that lets you install and update even the most complex Kubernetes apps. K8ssandra is Helm-based, and you can deploy all of its components with a single Helm command, saving you hours of sitting at your computer.
Figure 1. Diagram showing how Helm launches K8s clusters.
Prometheus
Prometheus is the software K8ssandra uses to collect useful metrics, monitor events in your Cassandra database, and issue alerts. Prometheus captures these metrics by “scraping” endpoints provided by the components within a Kubernetes cluster. To view these metrics, K8ssandra uses a nifty dashboard called Grafana, which we’ll look at next.
Figure 2. Diagram showing Prometheus’ modules and services.
Grafana
Grafana is a “visualization web application” that provides a user interface to display metrics. K8ssandra uses Grafana to pull metrics from Prometheus (using PromQL, the Prometheus query language) and present them in a dashboard. K8ssandra has already pre-configured some Grafana dashboards so you can easily monitor your Cassandra cluster.
Figure 3. Diagram showing how Grafana retrieves metrics from Prometheus.
Reaper
Managing Cassandra repairs comes with the territory. With data replication an essential part of Cassandra’s distributed architecture, every Cassandra cluster will need repairs to ensure all data replicas are consistent. This process, however, is notoriously tedious and difficult to do.
Reaper removes the headache by connecting to a Cassandra cluster, analyzing its health, and initiating (or scheduling) repairs. This lets you easily automate repairs at scale for Cassandra clusters running in Kubernetes, earning it a place within K8ssandra’s toolbox.
Figure 4. Diagram showing a single Reaper instance handling multiple data centers.
Stargate
Stargate is an open-source gateway that sits between your app and your Cassandra database. In short, it shields you from the complexity of Cassandra and gives you a group of APIs to easily interact with your database, without having to learn a bunch of languages or build microservices. These APIs are:
- REST to access your data using a familiar interface through RESTful APIs
- GraphQL to query any Cassandra database using GraphQL types, queries, and mutations
- Document APIs to save and search schemaless JSON documents in Cassandra
- gRPC to serve a Google RPC (gRPC) API from any Cassandra database
Figure 5. Diagram showing how Stargate fits into the Kubernetes architecture.
K8ssandra helpfully includes Stargate in its Cassandra ecosystem, so you’ll get to try out some of Stargate’s APIs in the following Katacoda scenario.
Scenario: deploy a sample app on Kubernetes with K8ssandra
Now that you have the right concepts in mind, it’s time to put them to use. To help you practice using the technologies in this workshop (without breaking anything), we’ve set up an interactive training scenario in Katacoda.
This scenario will walk you through the components of a cloud-native application deployed with Cassandra in Kubernetes. The app you’ll be deploying is the Pet Clinic app, which is simply a reference app for the Java Spring framework that manages data for a pet clinic business.
This exercise is completely beginner-friendly, and in just 15 minutes, you’ll learn how to:
- Install the K8ssandra ecosystem
- Deploy the Pet Clinic app
- Use Prometheus to collect system metrics
- Use Grafana to monitor the Cassandra database
- Use Reaper to manage Cassandra data replica consistency
- Access Cassandra using Stargate APIs
Ready to give it a try? Scroll to the bottom of the Apache Cassandra on Kubernetes Learning Series page and click “Start Scenario.” Once you’ve completed the exercise (and aced the sneaky quiz at the end), you’ll be one step closer to your official K8ssandra certification!