Time to Complete
20 minutes
Difficulty
Intermediate
If you’re building a world-class cloud-native app, no doubt you will be using Kubernetes, the most popular open-source container manager. Similarly, you need the reliability and scalability of Apache Cassandra™. While Kubernetes manages stateless systems easily, things get a bit more complicated in the stateful realm. Because Kubernetes doesn’t understand Cassandra database constructs, trying to work with Cassandra directly in kubernetes requires you to manage a myriad of minutia. We don’t want that! The DataStax Kubernetes Cassandra Operator moves us up levels of abstraction so we can deal with Cassandra using higher level constructs that are simple and make sense.
Get StartedAt a machine level (real or virtual), a Kubernetes Cluster consists of at least one manager node and some worker nodes. But, it might be best to think of machines as merely resources available to the more interesting constructs of Kubernetes.
What are these constructs? The basic building block in Kubernetes is a pod. Pods are like a private network that contains containers (e.g., Docker containers). The containers are like virtual machines within the pod’s private network. Normally, one scales a kubernetes system by scaling the number of pods, whereas the number of containers/pod remains constant.
Often, Kubernetes architectures associate a service with a set of similar pods. The service acts as a load balancer and can also provide network access to the pods. Services are not generally accessible outside a kubernetes cluster (with some exceptions), so we can configure an ingress to map network access from outside a kubernetes cluster to services inside the cluster.
The final Kubernetes construct to review is a deployment. A Deployment is a controller that facilitates updates of pods and services.
Next: How to use a Kubernetes Ingress?While there are several ways to provide external access to a Kubernetes cluster, using an ingress has many advantages. It is possible to create Kubernetes services that are externally accessible. For example, one can use a LoadBalancer service type or a NodePort service type to expose the service’s port externally. LoadBalancers are cloud service provider specific, so they may not be ideal for multi-cloud environments or where one is trying to avoid vendor lock-in. Using NodePort services can scatter cluster port access and make it a bit more complex to keep track of which ports that the Kubernetes cluster exposes.
An ingress provides one-stop for exposing access to a Kubernetes cluster. You can use an ingress to map external cluster ports to internal services. You can even map external URL endpoints to services.
When mapping ports between machines, ingresses, pods and containers, it can be confusing knowing which port is which. Here is a general Kubernetes naming convention:
An ingress maps a host port (and possibly a URL endpoint) to a service. The service, in turn, maps to a container.
Next: What is a Cassandra Operator and How Do I Use it?As we have discussed, Kubernetes deals with services and pods, while Cassandra deals with data centers. When deploying Cassandra on Kubernetes, it’s burdensome to have to worry about services, pods and containers when what you really care about is datacenters and databases. This is where the Kubernetes Cassandra Operator comes in.
When you deploy a Cassandra cluster using Cassandra Operator, you can specify higher-level Cassandra constructs in the manifest.
Besides using higher-level abstractions, Cassandra Operator also contains a Kubernetes controller, which monitors the health of the Cassandra cluster and restarts nodes as necessary. This controller also makes it possible to scale the Cassandra cluster with finesse (i.e., graceful rolling restarts. etc.).
Once you have installed the Cassandra Operator, you can easily deploy Cassandra clusters within a Kubernetes cluster (Notice that cluster is an overloaded term here. Sometimes it refers to a Kubernetes cluster, and sometimes it refers to a Cassandra cluster).
Next: Skill BuildingAre you ready to try it out? Learn how to deploy Cassandra with Kubernetes using the Cassandra Operator.
Learn to deploy the Cassandra-operator with Kubernetes
Simplify your ops-life by using the Kubernetes Cassandra Operator to run your Cassandra cluster!
In the previous scenario in this course, you learned how to run Cassandra using Docker. Docker containers make replication of Cassandra nodes possible, but it could be a lot of work to deploy them in a large cluster. This is where Kubernetes and the Cassandra Operator come in.
In this scenario, we'll learn how to:
Note: As we start to use Kubernetes, it is important to recognize that we are working with two types of clusters:
Here's what we will build.
Do you have a suggestion or issue you’ve discovered?
Share Feedback