Creating your first backup
In this guide, you will create a backup of a Kafka topic. The backup will be stored on a Persistent Volume .
You will configure:
- The EventHub to define the Kafka cluster.
- The Credentials to authenticate with the Kafka cluster.
- The Storage to store data on.
- The Backup using all of the above.
Pre-requisites
To follow this guide, make sure you have the following tools available:
- A Kubernetes cluster with Kannika Armory installed.
- A running Kafka cluster
- The kubectl CLI tool
- Access to the Kubernetes API.
- A Kubernetes cluster with Kannika Armory installed.
- A running Kafka cluster
- A GraphQL client like Postman.
- Access to the GraphQL API.
- A Kubernetes cluster with Kannika Armory installed.
- A running Kafka cluster
- An HTTP client like Postman.
- Access to the REST API.
Step 1: Configure an EventHub
An EventHub is a Kannika Armory resource that is used to depict an external system that contains event data. In this step, you will create a Kafka EventHub.
Create the following resource in Kubernetes:
In this example:
-
A Kafka EventHub named
my-kafka-cluster
is created. -
The EventHub points to a Kafka cluster at
broker:9092
.
To authenticate with the Kafka cluster, you’ll need to configure Credentials. In this example, you’ll use SASL/PLAIN Credentials with a username and password.
Create the following resources in Kubernetes:
In this example:
-
The Credentials are used for SASL/PLAIN authentication with the username
sasl-username
and passwordsasl-password
, which are stored in a Secret namedsasl-creds
. -
SSL encryption is enabled. This correlates to the Kafka property
security.protocol
being set toSASL_SSL
.
Step 2: Configure a Storage
Next, configure the Storage which will be used to store the backup data. In this example, a Volume Storage is used, which will store the data on a Persistent Volume .
Create the following Storage resource in Kubernetes:
In this example:
-
A Volume Storage named
my-volume-storage
is created. -
The volume has a capacity of
10Gi
.
Step 3: Configure the backup
Finally, create a Backup which will back up data from the EventHub on the Storage.
Create the following Backup resource in Kubernetes:
Configure the backup using the configureBackup
GraphQL mutation:
Then,
import topics using the enableBackupStreams
GraphQL mutation:
First,
create the backup using the POST /rest/backups
endpoint:
Then,
import topics using the POST /rest/backups/{backupName}/topics
endpoint:
In this example:
-
The Backup is named
my-backup
. -
The Backup uses the Credentials
sasl-creds
to authenticate with the Kafka cluster. -
The topic
my-topic
is added to the Backup.
Step 4: Verify that the backup is running
Congratulations on making it this far! You have now created your first backup, and it should be running.
To verify that the backup is running, run the following command:
You should see output similar to the following:
You should also see the associated Pod running:
You should see output similar to the following:
To verify that the backup is running, run the following query:
You should see output similar to this:
To verify that the backup is running, run the following command:
You should see output similar to this:
The backup is now running, and will continue to run until you delete it, or pause it.