### Clone and Setup Armory Examples Source: https://docs.kannika.io/0.17/tutorials/disaster-recovery/backup-with-s3-storage Clone the repository and run the setup script for the S3 backup example. ```bash git clone https://github.com/kannika-io/armory-examples.git cd armory-examples ./setup s3-minio-backup ``` -------------------------------- ### Install Armory Examples with Migration Script Source: https://docs.kannika.io/0.17/tutorials/environment-cloning/migrate-consumer-groups Use this curl command to download and execute the setup script for the migrate-consumer-groups scenario. ```bash curl -fsSL https://raw.githubusercontent.com/kannika-io/armory-examples/main/install.sh | bash -s -- migrate-consumer-groups ``` -------------------------------- ### Clone Armory Examples and Run Setup Source: https://docs.kannika.io/0.17/tutorials/environment-cloning/migrate-consumer-groups Clone the armory-examples repository and run the setup script for the migration scenario. ```bash git clone https://github.com/kannika-io/armory-examples.git cd armory-examples ./setup migrate-consumer-groups ``` -------------------------------- ### Install Armory Examples for Migration Source: https://docs.kannika.io/tutorials/environment-cloning/migrate-consumer-groups Use this command to download and install the necessary scripts for the consumer group migration scenario. ```bash curl -fsSL https://raw.githubusercontent.com/kannika-io/armory-examples/main/install.sh | bash -s -- migrate-consumer-groups ``` -------------------------------- ### Full Restore Example with Storage, EventHub, Credentials, and Restore Resources Source: https://docs.kannika.io/0.17/getting-started A comprehensive example detailing the setup for restoring data, including Storage, EventHub, Secret, Credentials, and the Restore resource itself. ```yaml # Storage - the source of the restore (where backups are stored) apiVersion: kannika.io/v1alpha kind: Storage metadata: name: my-volume-storage spec: volume: capacity: 10Gi --- # EventHub - the target Kafka cluster to restore to apiVersion: kannika.io/v1alpha kind: EventHub metadata: name: my-kafka-cluster spec: kafka: properties: bootstrap.servers: broker:9092 --- # Secret - stores the Kafka credentials apiVersion: v1 kind: Secret type: Opaque metadata: name: kafka-credentials data: username: bXktdXNlcm5hbWU= # base64 encoded password: bXktcGFzc3dvcmQ= # base64 encoded --- # Credentials - defines authentication to the Kafka cluster apiVersion: kannika.io/v1alpha kind: Credentials metadata: name: my-credentials spec: sasl: mechanism: PLAIN usernameFrom: secretKeyRef: name: kafka-credentials key: username passwordFrom: secretKeyRef: name: kafka-credentials key: password --- # Restore - restores topics from Storage to the EventHub apiVersion: kannika.io/v1alpha kind: Restore metadata: name: my-restore spec: source: my-volume-storage sink: my-kafka-cluster sinkCredentialsFrom: credentialsRef: name: my-credentials enabled: true config: topics: - source: my-topic target: my-topic ``` -------------------------------- ### Full Backup Example with EventHub, Credentials, and Storage Source: https://docs.kannika.io/0.17/getting-started A comprehensive example demonstrating the creation of EventHub, Secret, Credentials, Storage, and Backup resources for a complete Kafka topic backup setup. ```yaml # EventHub - defines the Kafka cluster connection apiVersion: kannika.io/v1alpha kind: EventHub metadata: name: my-kafka-cluster spec: kafka: properties: bootstrap.servers: broker:9092 --- # Secret - stores the Kafka credentials apiVersion: v1 kind: Secret type: Opaque metadata: name: kafka-credentials data: username: bXktdXNlcm5hbWU= # base64 encoded password: bXktcGFzc3dvcmQ= # base64 encoded --- # Credentials - defines authentication to the Kafka cluster apiVersion: kannika.io/v1alpha kind: Credentials metadata: name: my-credentials spec: sasl: mechanism: PLAIN usernameFrom: secretKeyRef: name: kafka-credentials key: username passwordFrom: secretKeyRef: name: kafka-credentials key: password --- # Storage - defines where backups are stored apiVersion: kannika.io/v1alpha kind: Storage metadata: name: my-volume-storage spec: volume: capacity: 10Gi --- # Backup - backs up topics from the EventHub to the Storage apiVersion: kannika.io/v1alpha kind: Backup metadata: name: my-backup spec: source: my-kafka-cluster sourceCredentialsFrom: credentialsRef: name: my-credentials sink: my-volume-storage streams: - topic: my-topic ``` -------------------------------- ### Clone Armory Examples Repository Source: https://docs.kannika.io/tutorials/environment-cloning/migrate-consumer-groups Clone the repository and run the setup script for the migration scenario if you prefer not to use the curl command. ```bash git clone https://github.com/kannika-io/armory-examples.git cd armory-examples ./setup migrate-consumer-groups ``` -------------------------------- ### Install Kannika Armory with S3 Backup Source: https://docs.kannika.io/0.17/tutorials/disaster-recovery/backup-with-s3-storage Use this command to install Kannika Armory with the S3 backup example pre-configured. ```bash curl -fsSL https://raw.githubusercontent.com/kannika-io/armory-examples/main/install.sh | bash -s -- s3-minio-backup ``` -------------------------------- ### Install Kannika Armory for Scheduled Snapshots Source: https://docs.kannika.io/0.17/tutorials/compliance/schedule-snapshots Use this command to install Kannika Armory with the schedule-snapshots component. Alternatively, clone the repository and run the setup script. ```bash curl -fsSL https://raw.githubusercontent.com/kannika-io/armory-examples/main/install.sh | bash -s -- schedule-snapshots ``` ```bash git clone https://github.com/kannika-io/armory-examples.git cd armory-examples ./setup schedule-snapshots ``` -------------------------------- ### Clone and Setup Kannika Armory for S3 Backup Source: https://docs.kannika.io/tutorials/disaster-recovery/backup-with-s3-storage Clone the armory-examples repository and run the setup script to configure S3 MinIO backup. ```bash git clone https://github.com/kannika-io/armory-examples.git cd armory-examples ./setup s3-minio-backup ``` -------------------------------- ### Example Deployment Output Source: https://docs.kannika.io/0.17/installation/installing-on-openshift This is an example of the expected output when verifying Kannika Deployments. It shows the status of the api, console, and operator Deployments. ```text NAME READY UP-TO-DATE AVAILABLE AGE api 1/1 1 1 1m console 1/1 1 1 1m operator 1/1 1 1 1m ``` -------------------------------- ### Install Kannika License Source: https://docs.kannika.io/0.17/getting-started Install your license to your Kubernetes cluster using kubectl. Replace with the path to your license file. ```bash $ kubectl create secret generic kannika-license \ --type=kannika.io/license \ --namespace kannika-system \ --from-file=license= ``` -------------------------------- ### Install pyyaml for Configuration Source: https://docs.kannika.io/0.17/user-guide/plugins/wasi Installs the pyyaml package, which is used for reading plugin configuration files. ```bash $ pip install pyyaml ``` -------------------------------- ### Install Kannika Helm Chart Source: https://docs.kannika.io/0.17/installation/installing-on-openshift Installs the Kannika platform using the official Helm chart on OpenShift. Ensure you have Helm and oc CLI installed and configured. ```bash helm install kannika oci://quay.io/kannika/charts/kannika \ --create-namespace \ --namespace kannika-system \ --version 0.17.2 \ -f values.yaml ``` -------------------------------- ### Example Fetched Offsets Source: https://docs.kannika.io/tutorials/environment-cloning/migrate-consumer-groups Example output showing consumer group offsets. This indicates the 'order-processor' group has processed up to offset 3 on the 'orders-prod' topic. ```text order-processor,orders-prod,0,103 ``` -------------------------------- ### Install cargo-component Source: https://docs.kannika.io/0.17/user-guide/plugins/wasi Install the `cargo-component` tool, which is necessary for building WebAssembly components from Rust projects. ```bash $ cargo install cargo-component ``` -------------------------------- ### Example New Storage YAML Source: https://docs.kannika.io/0.17/tutorials/compliance/schedule-snapshots This is an example of the YAML definition for a new Storage resource, showing its API version, kind, metadata, and spec. ```yaml apiVersion: kannika.io/v1alpha kind: Storage metadata: name: prod-storage-20260202120000 namespace: kannika-data spec: volume: capacity: 1Gi ``` -------------------------------- ### Install Kannika Armory Platform using Helm Source: https://docs.kannika.io/0.17/installation Installs the Kannika Armory platform using the Helm chart. This command installs all components into the 'kannika-system' namespace with the release name 'kannika'. ```bash helm install kannika oci://quay.io/kannika/charts/kannika \ --create-namespace \ --namespace kannika-system \ --version 0.17.2 ``` -------------------------------- ### Create OpenShift Project Source: https://docs.kannika.io/0.17/installation/installing-on-openshift Creates a new OpenShift project named 'kannika-system' for installing Kannika Armory. This should be done before other installation steps. ```bash oc new-project kannika-system ``` -------------------------------- ### Example Rotation Log Output Source: https://docs.kannika.io/0.17/tutorials/compliance/schedule-snapshots This is an example of the expected output when the storage rotation job runs successfully, showing the creation of a new storage resource. ```text Starting storage rotation at 20260202120000 Disabling backup... backup.kannika.io/prod-backup patched Waiting for backup to stop... statefulset.apps/prod-backup condition met Current storage: prod-storage New storage name: prod-storage-20260202120000 Creating new storage... storage.kannika.io/prod-storage-20260202120000 created Updating backup to use new storage... backup.kannika.io/prod-backup patched Re-enabling backup... backup.kannika.io/prod-backup patched Storage rotation complete New storage: prod-storage-20260202120000 ``` -------------------------------- ### Install Kannika CRDs using Helm Source: https://docs.kannika.io/0.17/installation/upgrading/0-14-x Install the Kannika CRDs using the provided Helm chart and version. ```bash $ helm install kannika-crd oci://quay.io/kannika/charts/kannika-crd \ --version 0.14.1 ``` -------------------------------- ### Install Kannika Armory with S3 Backup Support Source: https://docs.kannika.io/tutorials/disaster-recovery/backup-with-s3-storage Use this command to install Kannika Armory with S3 MinIO backup support via curl. ```bash curl -fsSL https://raw.githubusercontent.com/kannika-io/armory-examples/main/install.sh | bash -s -- s3-minio-backup ``` -------------------------------- ### Quantity Constraints and Examples Source: https://docs.kannika.io/refs/0.17.2/crd/kannika-crd-v1alpha.yml Explains the constraints for the Quantity type, including maximum magnitude and decimal places. Provides examples of canonical form serialization. ```text No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: - No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible. The sign will be omitted unless the number is negative. Examples: - 1.5 will be serialized as "1500m" - 1.5Gi will be serialized as "1536Mi" Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation. ``` -------------------------------- ### Install Kannika with Separate Resource Namespace Source: https://docs.kannika.io/0.17/installation/configuration/namespaces Use this command to install Kannika Armory, specifying distinct namespaces for the system and resources. The `--create-namespace` flag ensures the system namespace is created if it doesn't exist. ```bash $ helm install kannika oci://quay.io/kannika/charts/kannika \ --create-namespace \ --namespace kannika-system \ --version 0.17.2 \ --set global.kubernetes.namespace=kannika-data ``` -------------------------------- ### Quantity Serialization Examples Source: https://docs.kannika.io/refs/0.17.2/crd/kannika-crd-v1alpha.yml Illustrates how quantities are serialized, showing the conversion of decimal numbers to their canonical form with appropriate suffixes. Non-canonical values are parsed but re-emitted in canonical form. ```text - 1.5 will be serialized as "1500m" - 1.5Gi will be serialized as "1536Mi" ``` -------------------------------- ### Initialize Go Project Source: https://docs.kannika.io/0.17/user-guide/plugins/wasi Create a new Go project directory and initialize it with go mod init. ```bash $ mkdir go-passthru $ cd go-passthru $ go mod init go-passthru ``` -------------------------------- ### Create Plugin Development Environment Source: https://docs.kannika.io/0.17/user-guide/plugins/wasi Sets up a new directory, virtual environment, and activates it for plugin development. ```bash $ mkdir off-with-their-headers $ cd off-with-their-headers $ python -m venv venv $ source venv/bin/activate ``` -------------------------------- ### Kubernetes Services for Kannika Armory Source: https://docs.kannika.io/0.17/installation/configuration/networking Example output of `kubectl get svc` command showing the ClusterIP services for Kannika Armory components within the `kannika-system` namespace. ```bash $ kubectl get svc -n kannika-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE api ClusterIP 10.96.124.99 8080/TCP 1m console ClusterIP 10.96.46.216 8080/TCP 1m ... ``` -------------------------------- ### Configure Backup (GraphQL) Source: https://docs.kannika.io/0.17/getting-started/creating-your-first-backup Use the `configureBackup` GraphQL mutation to set up a backup. Provide the backup name, source EventHub, source credentials name, and sink storage name. ```graphql mutation { configureBackup( input: { name: "my-backup", sourceEventHubName: "my-kafka-cluster", sourceCredentialsName: "sasl-creds", sinkStorageName: "my-volume-storage", } ) { ...on BackupConfigured { backup { name } ...on BackupConfigurationFailed { problems { message type } } } } ``` -------------------------------- ### CronJob for Snapshot Rotation Source: https://docs.kannika.io/0.17/tutorials/compliance/schedule-snapshots This CronJob automates the process of rotating backup storage by disabling the backup, creating new storage, updating the backup to point to the new storage, and re-enabling the backup. It includes steps to install kubectl, disable the backup, wait for it to stop, get current storage configuration, create new storage, update the backup, and re-enable it. ```yaml # https://github.com/kannika-io/armory-examples/blob/main/tutorials/schedule-snapshots/k8s/rotate-backup-storage.cronjob.yaml apiVersion: batch/v1 kind: CronJob metadata: name: rotate-backup-storage namespace: kannika-data spec: schedule: "0 0 * * *" # Run at midnight daily jobTemplate: spec: template: spec: serviceAccountName: backup-storage-rotate-sa restartPolicy: OnFailure containers: - name: rotate image: alpine:3 command: - /bin/sh - -c - | set -e # Install kubectl wget -qO /usr/local/bin/kubectl \ "https://dl.k8s.io/release/$(wget -qO- https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" chmod +x /usr/local/bin/kubectl BACKUP_NAME="prod-backup" NAMESPACE="kannika-data" TIMESTAMP=$(date +%Y%m%d%H%M%S) echo "Starting storage rotation at ${TIMESTAMP}" # Step 1: Disable the backup to flush segments echo "Disabling backup..." kubectl patch backup ${BACKUP_NAME} -n ${NAMESPACE} \ --type merge \ -p '{"spec":{"enabled":false}}' # Wait for backup StatefulSet to scale down echo "Waiting for backup to stop..." kubectl wait statefulset -l io.kannika/backup=${BACKUP_NAME} -n ${NAMESPACE} \ --for=jsonpath='{.status.replicas}'=0 \ --timeout=60s # Step 2: Get current storage configuration CURRENT_STORAGE=$(kubectl get backup ${BACKUP_NAME} -n ${NAMESPACE} \ -o jsonpath='{.spec.sink}') echo "Current storage: ${CURRENT_STORAGE}" # Extract base name (remove any existing timestamp suffix) BASE_NAME=$(echo ${CURRENT_STORAGE} | sed 's/-[0-9]\\{14\\}$//') NEW_STORAGE_NAME="${BASE_NAME}-${TIMESTAMP}" echo "New storage name: ${NEW_STORAGE_NAME}" # Step 3: Create new storage with timestamp # Extract the spec from current storage VOLUME_CAPACITY=$(kubectl get storage ${CURRENT_STORAGE} -n ${NAMESPACE} \ -o jsonpath='{.spec.volume.capacity}') echo "Creating new storage..." cat <