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
-
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.
-
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: -
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.
-
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
-
For the complete set of version-specific manifests, see this GitHub page.
-
Here is the YAML file applied in this v1.16 example.
-
-
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 theStorageClass
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.
-
-
Finally, run the following
kubectl
command to apply a YAML manifest that defines aCassandraDatacenter
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.
-
Navigate to the Kubernetes Engine page in Cloud Console, and log into your account. If you have not already done so, select your project.
-
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:
You can access similar information and the YAML manifest used to define the configuration from the Storage tab in the left navigation.
-
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:
Select Services & Ingress to see how the Service labels for the deployed
cluster1
Cassandra cluster and for thedc1
datacenter correspond to the YAML manifest applied usingkubectl
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:
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 thecassandra 3.11.7
image. This container is deployed to your Kubernetes cluster and matches the YAML configuration applied earlier in this topic.Example:
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.