Get Started with Kubernetes Operator for Apache Cassandra

Apply pre-configured Kubernetes Operator for Apache Cassandra manifests and related definitions to your Kubernetes cluster.

Prerequisites

  1. An existing Kubernetes (K8s) cluster is required before proceeding to set up Kubernetes Operator for Apache Cassandra and Apache Cassandra® resources.

    If you have not already, Create a Kubernetes cluster.

  2. An authorized connection established between your local machine (from which kubectl commands are run) and your existing Kubernetes cluster. For more, see these sections from Create a Kubernetes cluster:

  3. The kubectl CLI tool.

Quick start

The following kubectl commands create Kubernetes Operator for Apache Cassandra and Apache Cassandra® resources on an existing GKE cloud that is running Google Kubernetes Engine (GKE) version 1.16. Adjust the commands based on your cloud, storage, and database options.

  1. Run this kubectl command to reference a YAML file that applies the Kubernetes Operator for Apache Cassandra manifest’s definitions to the connected Kubernetes cluster.

    kubectl create -f https://raw.githubusercontent.com/k8ssandra/cass-operator/v1.7.1/docs/user/cass-operator-manifests.yaml
  2. Run the following kubectl command to apply a YAML manifest that defines the storage settings to use for Cassandra nodes in a cluster. An example is SSD as a storage type. In this case, storage settings are for a GKE cluster. Kubernetes uses the StorageClass resource as an abstraction layer between pods needing persistent storage and the physical storage resources that a specific Kubernetes cluster can provide.

    kubectl create -f https://raw.githubusercontent.com/k8ssandra/cass-operator/v1.7.1/operator/k8s-flavors/gke/storage.yaml
    • For more options, see this GitHub page.

    • Here is the YAML manifest applied in this storage configuration example.

  3. Finally, run the following kubectl command to apply a YAML manifest that defines a CassandraDatacenter with the open-source Apache Cassandra® 3.11.7 image with three nodes on one rack in the Kubernetes cluster.

    kubectl -n cass-operator create -f https://raw.githubusercontent.com/k8ssandra/cass-operator/v1.7.1/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml

    An alternative command is to create the CassandraDatacenter with the DataStax Enterprise (DSE) 6.8.4 image, with three Kubernetes worker nodes on one rack, using:

    kubectl -n cass-operator create -f https://raw.githubusercontent.com/k8ssandra/cass-operator/master/operator/example-cassdc-yaml/dse-6.8.x/example-cassdc-minimal.yaml
    • For the complete set of database-specific datacenter configurations, DSE or Cassandra, see this GitHub page.

    • Here is the YAML manifest applied in this Cassandra 3.11.7 datacenter configuration example.

Resources deployed and visible in Cloud Console

With the Kubernetes Operator for Apache Cassandra manifest, storage class, and datacenter definitions applied to the Kubernetes cluster, view the resources created and visible in the Kubernetes cluster. This GKE example uses the Google Cloud Console (aka Cloud Console), and the resources already established in Create a Kubernetes cluster.

  1. Navigate to the Kubernetes Engine page in Cloud Console, and log into your account. If you have not already done so, select your project.

  2. On the Clusters tab, click the link for your cluster’s name. Navigate through the Details, Storage, and Nodes sections to familiarize yourself with the created resources. Here is an example from the Storage section of the Clusters tab:

    Storage details in Cloud Console’s Kubernetes Engine Clusters tab reflecting the settings created by the applied YAML files

    You can access similar information and the YAML manifest used to define the configuration from the Storage tab in the left navigation.

  3. Click the Workloads tab. Workloads are deployable computing units that can be created and managed in the Kubernetes cluster. The Kubernetes Operator for Apache Cassandra manifest applied the YAML file applied that defined the cass-operator namespace and workload. Click the Cluster link on the Workloads page to load details about the Kubernetes Operator for Apache Cassandra and Cassandra deployments in the Kubernetes cluster.

    Example:

    Workload details for cass-operator in Cloud Console

    Select Services & Ingress to see how the Service labels for the deployed cluster1 Cassandra cluster and for the dc1 datacenter correspond to the YAML manifest applied using kubectl earlier in this topic. Notice the three serving pods. Services are sets of pods with a network endpoint that can be used for discovery and load balancing. Ingresses are collections of rules for routing external HTTP or HTTPS traffic to Services.

    From the initial Services tab, click the cluster1-dc1-service and Cloud Console displays the status.

    Example:

    Service details for cluster1 Cassandra cluster and dc1 datacenter Cloud Console Kubernetes Engine Services tab

    For more details, scroll to the Serving pods section, and select the link for one of the serving pods. The Cloud Console switches to the Workloads tab, and the Pod details page includes the status labels, such as cassandra.datastax.com/node-state: Started and additional metadata. Scroll down to the Containers section and notice the running container for the cassandra 3.11.7 image. This container is deployed to your Kubernetes cluster and matches the YAML configuration applied earlier in this topic.

    Example:

    Services tab has Containers section with status of the Cassandra 3.11.7 image container

While many more options are available in Cloud Console, this introduction familiarizes you with the basics, and shows how applying the provided YAML files results in the creation and deployment of those Kubernetes Operator for Apache Cassandra and Cassandra resources in the Kubernetes cluster.

What’s next?

Now that you have deployed Kubernetes Operator for Apache Cassandra and Cassandra to your Kubernetes cluster, connect to Cassandra database.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com