Using Instaclustr With Kubernetes
What Is the Instaclustr Operator?
The Instaclustr Operator is an open-source operator that allows you to create, manage, and delete resources on the Instaclustr Cloud. It allows you to manage your cloud resources via custom resources using YAML manifests.
The Instaclustr Operator is a logical abstraction of an upstream API. Instead of having to write custom API calls or use the Instaclustr Console, you can use an operator.
What Can You Do With the Instaclustr Operator?
Instaclustr provides the Instaclustr Operator which enables users to directly interact with and provision cloud resources for their Instaclustr infrastructure via Kubernetes, without having to write their own code to connect the APIs together. This makes it simpler for customers to integrate Instaclustr provisioning and management into their current workflows for Kubernetes clusters.
The Instaclustr Operator works with open-source technologies we currently offer, including Apache Cassandra, Apache Kafka and Kafka add-ons, Apache Spark, OpenSearch, Redis, Apache ZooKeeper, and Cadence.
The Instaclustr Operator works by making use of the Instaclustr Provisioning API.
Examples and How-To Guide
The Instaclustr Operator is easy to install and start using with Helm. Below we have a few code snippets so you can quickly get started. For additional information, please see the GitHub repository.
This documentation page will instruct you on how to install the Instaclustr Operator in your Kubernetes cluster and how to use it to create and manage Instaclustr products, using Apache Cassandra as an example. Additionally, you can view our tutorial video to watch these instructions step-by-step.
We will complete the following steps:
- Install the Instaclustr Operator
- Create a Cassandra cluster
- Update a Cassandra cluster
- Delete a Cassandra cluster
Install the Instaclustr Operator on a Kubernetes Cluster
- You need to have cert-manager on your cluster. You can install it using following:
1kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.0/cert-manager.yaml - Before you can install the Instaclustr Operator, you need to have Helm. Refer to this guide on how to download and install Helm.
- Now you can use Helm to add operator-chart on your Kubernetes cluster using following:
1helm repo add operator-chart https://instaclustr.github.io/operator-helm/ - Refer to this Helm documentation page for more details on adding helm charts. Install helm chart:
123456789helm install operator operator-chart/operator \--set USERNAME=<Instaclustr Username>\--set APIKEY=<Provisoining API Key>\--set HOSTNAME=api.instaclustr.com \-n test-namespace --create-namespace
Set your own values to the USERNAME and APIKEY in order to authenticate with Instaclustr. First you need to obtain your API key. It can be found within your Instaclustr account on the Instaclustr Console under the Account Settings ⇒ API Keys page; then click the Add button for Provisioning to generate the API Key. For security reasons, this key is only displayed once, so be sure to store a copy of it somewhere secure. For more information, please refer to the API Keys documentation page.
Default value for HOSTNAME is api.instaclustr.com. You can change it if you want to use another hostname. Use the official Instaclustr API documentation for more details.
More details on installing helm charts here. For further information on installing helm charts, please refer to this Helm documentation page.
- Now you can run following command to check if operator is running:
1kubectl get pods -n test-namespace
Apache Cassandra Cluster Examples
When the Instaclustr Operator is running you can create and manage your clusters using custom resources.
Create an Apache Cassandra Cluster
- To create a custom resource, you need a resource manifest. Use the following yaml file as an example:
123456789101112131415161718192021222324apiVersion: clusters.instaclustr.com/v1alpha1kind: Cassandrametadata:name: cassandra-examplespec:name: "CassandraExample"version: "3.11.13"dataCentres:- name: "AWS_cassandra"region: "US_EAST_1"cloudProvider: "AWS_VPC"continuousBackup: falsenodesNumber: 2replicationFactor: 2privateIpBroadcastForDiscovery: falsenetwork: "172.16.0.0/19"tags:"tag": "testTag"clientToClusterEncryption: falsenodeSize: "CAS-DEV-t4g.small-30"pciCompliance: falseluceneEnabled: falsepasswordAndUserAuth: trueslaTier: "NON_PRODUCTION" - Next, you need to create custom resource using the manifest:
1kubectl apply -f cassandra-example.yaml -n test-namespace - Now you can check the Cassandra cluster’s status using the following command:
1kubectl describe cassandras.clusters.instaclustr.com cassandra-example -n test-namespace
Update an Apache Cassandra Cluster
To update a custom resource, you need to edit its manifest and apply changes to it. Run following after you made changes to resource manifest:
1 |
kubectl apply -f cassandra-example.yaml -n test-namespace |
Delete an Apache Cassandra Cluster
To delete a custom resource, you need to use the following command:
1 |
kubectl delete cassandras.clusters.instaclustr.com cassandra-example -n test-namespace |
Resource deletion can take some time, you can also check resource status when deletion is in progress.
For more information, please see our documentation on Deleting a Cluster.
Additional Resources
- Instaclustr Provisioning API
- Instaclustr Open Source Project Status
- Instaclustr Operator Helm GitHub repository