### Setup and Run Basic Kafka Transaction Example Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2023-05-03-kafka-transactions.md This script downloads Kafka, starts a single-node cluster, clones a Kafka transaction example application, and runs it. Ensure you have curl, tar, java, and mvn installed. ```sh # download the Apache Kafka binary and start a single-node Kafka cluster in background $ KAFKA_VERSION="3.4.0" KAFKA_HOME="$(mktemp -d -t kafka.XXXXXXX)" && export KAFKA_HOME $ curl -sLk "https://archive.apache.org/dist/kafka/$KAFKA_VERSION/kafka_2.13-$KAFKA_VERSION.tgz" \ | tar xz -C "$KAFKA_HOME" --strip-components 1 $ $KAFKA_HOME/bin/zookeeper-server-start.sh -daemon $KAFKA_HOME/config/zookeeper.properties \ && sleep 5 && $KAFKA_HOME/bin/kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties # open a new terminal, get and run the application (Ctrl+C to stop) $ git clone git@github.com:fvaleri/examples.git -n --depth=1 --filter=tree:0 && cd examples \ && git sparse-checkout set --no-cone kafka/kafka-txn && git checkout 957981f5d8ede82a265f695d9a10c83a50af718f ... HEAD is now at 957981f Only reset affected partitions $ export BOOTSTRAP_SERVERS="localhost:9092" INSTANCE_ID="kafka-txn-0" \ GROUP_ID="my-group" INPUT_TOPIC="input-topic" OUTPUT_TOPIC="output-topic" $ mvn clean compile exec:java -q -f kafka/kafka-txn/pom.xml Starting instance kafka-txn-0 Created topics: input-topic Waiting for new data ... ``` -------------------------------- ### Start Minikube with Specific Resources Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-10-25-kafka-authentication-using-oauth-2.0.md Example configuration for starting minikube with allocated memory and CPU resources. ```bash minikube start --memory=4096 --cpus=4 ``` -------------------------------- ### Start Minikube Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-11-01-deploying-debezium-with-kafkaconnector-resource.md Starts a Minikube instance with allocated memory. Ensure Minikube is installed and configured before running. ```shell minikube start --memory=4096 ``` -------------------------------- ### Build and Serve Website Locally Source: https://github.com/strimzi/strimzi.github.io/blob/main/README.md Install project dependencies and start a local server to view the website. The website will be accessible at localhost:4000. ```bash bundle install bundle exec jekyll serve ``` -------------------------------- ### Including an Assembly in a Guide Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2020-02-14-creating-doc-assemblies.md Provides an example of how to incorporate a complete assembly into a larger guide or another assembly using a simple include statement. ```asciidoc include::oauth/assembly-oauth.adoc[leveloffset=+1] ``` -------------------------------- ### User Operator Deployment Output Example Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/deploying.html Example output from 'kubectl get deployments' showing the status of the strimzi-user-operator deployment. 'READY' indicates the number of replicas that are ready out of the expected total. ```text NAME READY UP-TO-DATE AVAILABLE strimzi-user-operator 1/1 1 1 ``` -------------------------------- ### Run Debezium Example MySQL Docker Container Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-11-01-deploying-debezium-with-kafkaconnector-resource.md Starts a MySQL server in a Docker container for Debezium examples. Ensure the container is running before proceeding. ```shell docker run -it --rm --name mysql -p 3306:3306 \ -e MYSQL_ROOT_PASSWORD=debezium -e MYSQL_USER=mysqluser \ -e MYSQL_PASSWORD=mysqlpw debezium/example-mysql:1.0 ``` -------------------------------- ### Kafka Connect Pod Status Example Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2020-09-22-data-explorer-kafka-connect.md Example output showing a Kafka Connect pod in the 'Running' state. ```text NAME READY STATUS RESTARTS AGE my-connect-cluster-connect-5bf9db5d9f-9ttg4 1/1 Running 0 1m ``` -------------------------------- ### File Naming Examples Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/contributing.html Examples of file naming conventions for different types of documentation modules. ```asciidoc snip-intro-custom-resources (Snippet of reusable content) ``` ```asciidoc con-pod-management.adoc (Concept module) ``` ```asciidoc proc-creating-logging-filters.adoc (Procedure module) ``` ```asciidoc ref-list-of-mirrormaker2-resources.adoc (Reference module) ``` ```asciidoc assembly-deploy-kafka-cluster.adoc (Assembly of concepts and procedures) ``` -------------------------------- ### Install Git on Fedora Source: https://github.com/strimzi/strimzi.github.io/blob/main/contributing/guide/full.html Use the appropriate command to install git on Fedora systems, depending on the version. ```bash yum install git (up to Fedora 21) ``` ```bash dnf install git (Fedora 22 and later) ``` -------------------------------- ### Example Topology-label Rack Configuration Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/configuring-book.html An example of how to configure topology-label-based rack awareness for a Kafka custom resource. ```APIDOC ## Example Topology-label Rack Configuration ```yaml apiVersion: kafka.strimzi.io/v1 kind: Kafka metadata: name: my-cluster spec: kafka: # ... rack: type: topology-label topologyKey: topology.kubernetes.io/zone # ... ``` ``` -------------------------------- ### Example HTTP Request for Assigning Partitions Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/bridge/latest/latest.html This is an example of an HTTP request body to assign topic partitions to a consumer instance. ```json { "partitions" : [ { "topic" : "topic", "partition" : 0 }, { "topic" : "topic", "partition" : 1 } ] } ``` -------------------------------- ### Create a Source Connector Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2024-11-04-managing-connector-offsets.md Applies a Strimzi example configuration to create a source connector. ```bash kubectl apply -f https://strimzi.io/examples/latest/connect/source-connector.yaml -n kafka ``` -------------------------------- ### Example PodTemplate Configuration Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/configuring.html This example demonstrates how to configure a PodTemplate, including metadata, image pull secrets, security context, termination grace period, and host aliases. ```yaml # ... template: pod: metadata: labels: label1: value1 annotations: anno1: value1 imagePullSecrets: - name: my-docker-credentials securityContext: runAsUser: 1000001 fsGroup: 0 terminationGracePeriodSeconds: 120 hostAliases: - ip: "192.168.1.86" hostnames: - "my-host-1" - "my-host-2" #... ``` -------------------------------- ### Example Plugin Directory Structure Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/deploying.html This shows an example structure for the connector plugin files within the './my-plugins/' directory. Ensure all necessary JAR files for your connectors are included. ```tree $ tree ./my-plugins/ ./my-plugins/ ├── debezium-connector-mongodb │ ├── bson-.jar │ ├── CHANGELOG.md │ ├── CONTRIBUTE.md │ ├── COPYRIGHT.txt │ ├── debezium-connector-mongodb-.jar │ ├── debezium-core-.jar │ ├── LICENSE.txt │ ├── mongodb-driver-core-.jar │ ├── README.md │ └── # ... ├── debezium-connector-mysql │ ├── CHANGELOG.md │ ├── CONTRIBUTE.md │ ├── COPYRIGHT.txt │ ├── debezium-connector-mysql-.jar │ ├── debezium-core-.jar │ ├── LICENSE.txt │ ├── mysql-binlog-connector-java-.jar │ ├── mysql-connector-java-.jar │ ├── README.md │ └── # ... └── debezium-connector-postgres ├── CHANGELOG.md ├── CONTRIBUTE.md ├── COPYRIGHT.txt ├── debezium-connector-postgres-.jar ├── debezium-core-.jar ├── LICENSE.txt ├── postgresql-.jar ├── protobuf-java-.jar   ├── README.md └── # ... ``` -------------------------------- ### Start Minikube Tunnel Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-10-25-kafka-authentication-using-oauth-2.0.md Run this command in a separate terminal to ensure LoadBalancer services get their external IPs assigned when using minikube. ```bash sudo minikube tunnel ``` -------------------------------- ### Deploy Tracing Client Examples Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2023-03-01-opentelemetry.md Apply the Kubernetes configuration to deploy the instrumented HTTP producer and consumer clients. ```shell kubectl apply -f deployment-tracing-opentelemetry.yaml ``` -------------------------------- ### Start a 3-Broker KRaft Kafka Cluster Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2026-01-15-strimzi-test-container.md Use `StrimziKafkaCluster` to programmatically create and manage a Docker-based KRaft Kafka cluster for testing. This example configures a 3-broker cluster with a shared network. ```java StrimziKafkaCluster kafkaCluster = new StrimziKafkaCluster.StrimziKafkaClusterBuilder() .withNumberOfBrokers(3) .withSharedNetwork() .build(); kafkaCluster.start(); // Your tests here... kafkaCluster.stop(); ``` -------------------------------- ### Start Kafka Client Pod Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-10-25-kafka-authentication-using-oauth-2.0.md Apply the Kafka client pod configuration to the 'clients' namespace. ```bash kubectl apply -n clients -f kafka-client.yaml ``` -------------------------------- ### Custom Client Authentication with AWS MSK IAM Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/configuring.html Example configuration for custom client authentication using AWS MSK IAM. The 'config' section accepts options starting with 'sasl.' or 'ssl.keystore.'. ```yaml authentication: type: custom sasl: true config: sasl.mechanism: AWS_MSK_IAM sasl.jaas.config: software.amazon.msk.auth.iam.IAMLoginModule required; sasl.client.callback.handler.class: software.amazon.msk.auth.iam.IAMClientCallbackHandler ``` -------------------------------- ### Initial Reassignment JSON Configuration Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2022-09-16-reassign-partitions.md This is an example of the reassignment JSON file used to define partition replica and log directory configurations. It's a starting point before specifying custom log directories. ```json [ { "topic": "my-topic-two", "partition": 0, "replicas": [ 0, 3, 1, 2 ], "log_dirs": [ "any", "any", "any", "any" ] }, { "topic": "my-topic-two", "partition": 1, "replicas": [ 1, 0, 2, 3 ], "log_dirs": [ "any", "any", "any", "any" ] }, { "topic": "my-topic-two", "partition": 2, "replicas": [ 2, 1, 3, 0 ], "log_dirs": [ "any", "any", "any", "any" ] } ] ``` -------------------------------- ### Run HTTP Bridge with Configuration File Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/bridge/latest/latest.html Execute the HTTP Bridge startup script, providing a path to the application.properties file for custom configuration. Ensure the configuration properties are correctly set for the bridge to start. ```bash ./bin/kafka_bridge_run.sh --config-file=/application.properties ``` -------------------------------- ### Cluster Operator Setup in System Tests Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2020-12-03-how-the-system-tests-works.md This Java code demonstrates how to set up class-level resources for system tests by configuring the ResourceManager to use the class stack and then installing the Cluster Operator into a specified namespace. This is typically done in a `@BeforeAll` method. ```java @BeforeAll void createClassResources() { ResourceManager.setClassResources(); // resource manager uses the class stack installClusterOperator(NAMESPACE); // install cluster operator into NAMESPACE } ``` -------------------------------- ### AsciiDoc Configuration Example with Callouts Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/contributing-book.html Configuration examples should be provided in AsciiDoc code blocks, specifying the source language (e.g., 'yaml') and using 'subs' for attributes and formatting. Use '# ' for callout numbers and '# ... ' for omitted lines. ```yaml apiVersion: {KafkaApiVersion} kind: Kafka metadata: name: my-cluster spec: kafka: replicas: 3 # <1> (2) # ... (3) ``` -------------------------------- ### Observe Kafka Pods with Node Pool Naming Convention Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2023-08-14-kafka-node-pools-introduction.md When using node pools, Kafka pods are automatically named by Strimzi, incorporating the cluster name, node pool name, and assigned node ID. This example shows a typical output from `kubectl get pods`. ```bash $ kubectl get pods NAME READY STATUS RESTARTS AGE my-cluster-entity-operator-6784f64f9c-55pfh 2/2 Running 0 2m45s my-cluster-pool-a-0 1/1 Running 0 3m10s my-cluster-pool-a-1 1/1 Running 0 3m10s my-cluster-pool-a-2 1/1 Running 0 3m10s my-cluster-pool-b-3 1/1 Running 0 3m10s my-cluster-pool-b-4 1/1 Running 0 3m10s my-cluster-pool-b-5 1/1 Running 0 3m10s my-cluster-zookeeper-0 1/1 Running 0 4m33s my-cluster-zookeeper-1 1/1 Running 0 4m33s my-cluster-zookeeper-2 1/1 Running 0 4m33s strimzi-cluster-operator-58c8cf6469-f25wj 1/1 Running 0 4m21s ``` -------------------------------- ### YAML Configuration Example with Callouts Source: https://github.com/strimzi/strimzi.github.io/blob/main/contributing/guide/full.html Provide YAML configuration examples in AsciiDoc source blocks. Use `subs="+quotes,attributes"` for attributes and formatting. Use `#` before callout numbers for copy-friendliness and `# ...` for omitted lines. ```yaml apiVersion: {KafkaApiVersion} kind: Kafka metadata: name: my-cluster spec: kafka: replicas: 3 # <1> # ... ``` -------------------------------- ### Install Operator Lifecycle Manager Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-10-08-strimzi-apache-kafka-and-tracing.md Installs the Operator Lifecycle Manager, a prerequisite for installing other operators like Jaeger. ```sh curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/0.12.0/install.sh | bash -s 0.12.0 ``` -------------------------------- ### Install Strimzi Kafka Operator Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-10-25-kafka-authentication-using-oauth-2.0.md Installs the Strimzi Kafka Operator CRDs and operator, adjusting the namespace to 'kafka'. Ensure you have kubectl and curl installed. ```bash kubectl create ns kafka curl -L https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.14.0/strimzi-cluster-operator-0.14.0.yaml \ | sed 's/namespace: .*/namespace: kafka/' \ | kubectl apply -f - -n kafka ``` -------------------------------- ### Example Topic Configuration and Partition Details Response Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/bridge/latest/latest.html Example JSON response detailing the configuration and partition information for a Kafka topic. ```json { "name": "bridge-quickstart-topic", "configs": { "compression.type": "producer", "leader.replication.throttled.replicas": "", "min.insync.replicas": "1", "message.downconversion.enable": "true", "segment.jitter.ms": "0", "cleanup.policy": "delete", "flush.ms": "9223372036854775807", "follower.replication.throttled.replicas": "", "segment.bytes": "1073741824", "retention.ms": "604800000", "flush.messages": "9223372036854775807", "message.format.version": "2.8-IV1", "max.compaction.lag.ms": "9223372036854775807", "file.delete.delay.ms": "60000", "max.message.bytes": "1048588", "min.compaction.lag.ms": "0", "message.timestamp.type": "CreateTime", "preallocate": "false", "index.interval.bytes": "4096", "min.cleanable.dirty.ratio": "0.5", "unclean.leader.election.enable": "false", "retention.bytes": "-1", "delete.retention.ms": "86400000", "segment.ms": "604800000", "message.timestamp.difference.max.ms": "9223372036854775807", "segment.index.bytes": "10485760" }, "partitions": [ { "partition": 0, "leader": 0, "replicas": [ { "broker": 0, "leader": true, "in_sync": true }, { "broker": 1, "leader": false, "in_sync": true }, { ``` -------------------------------- ### Install Strimzi Cluster Operator with Helm Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/deploying.html Use this command to install the Strimzi Cluster Operator using the Helm command-line tool. Ensure the Helm client is installed. ```bash helm install strimzi-cluster-operator oci://quay.io/strimzi-helm/strimzi-kafka-operator ``` -------------------------------- ### kafka-log-dirs.sh Output Example Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2025-02-13-moving-data-between-JBOD-disks-using-cruise-control.md Example output from the kafka-log-dirs.sh command, showing the partition distribution across different log directories for brokers. ```json { "brokers": [ { "broker": 4, "logDirs": [ { "partitions": [], "error": null, "logDir": "/var/lib/kafka/data-2/kafka-log4" }, { "partitions": [ { "partition": "my-topic-0", "size": 0, "offsetLag": 0, "isFuture": false }, { "partition": "my-topic-1", "size": 0, "offsetLag": 0, "isFuture": false }, { "partition": "my-topic-2", "size": 0, "offsetLag": 0, "isFuture": false } ], "error": null, "logDir": "/var/lib/kafka/data-0/kafka-log4" }, { "partitions": [], "error": null, "logDir": "/var/lib/kafka/data-1/kafka-log4" } ] }, { "broker": 5, "logDirs": [ { "partitions": [], "error": null, "logDir": "/var/lib/kafka/data-1/kafka-log5" }, { "partitions": [ { "partition": "my-topic-0", "size": 0, "offsetLag": 0, "isFuture": false }, { "partition": "my-topic-1", "size": 0, "offsetLag": 0, "isFuture": false }, { "partition": "my-topic-2", "size": 0, "offsetLag": 0, "isFuture": false } ], "error": null, "logDir": "/var/lib/kafka/data-0/kafka-log5" }, { "partitions": [], "error": null, "logDir": "/var/lib/kafka/data-2/kafka-log5" } ] }, { "broker": 3, "logDirs": [ { "partitions": [ { "partition": "my-topic-0", "size": 0, "offsetLag": 0, "isFuture": false }, { "partition": "my-topic-1", "size": 0, "offsetLag": 0, "isFuture": false }, { "partition": "my-topic-2", "size": 0, ``` -------------------------------- ### Invalid Record Response Example Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/bridge/latest/latest.html An example of an error response when the provided record is not valid. ```json { "error_code" : 422, "message" : "The record is not valid." } ``` -------------------------------- ### Example Stack Trace Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2023-01-25-auto-restarting-connectors.md This is an example of a stack trace from a failed Kafka Connect task. ```java at cz.scholz.kafka.connect.echosink.EchoSinkTask.put(EchoSinkTask.java:131) at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:581) at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:333) at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:234) at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:203) at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:189) at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:244) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) ``` -------------------------------- ### YAML Configuration Example with AsciiDoc Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/contributing.html Provide configuration examples in AsciiDoc source blocks. Use `[source,yaml,subs="+quotes,attributes"]` for YAML files. Use `#` for callout numbers and `# ...` for omitted lines. ```yaml apiVersion: {KafkaApiVersion} kind: Kafka metadata: name: my-cluster spec: kafka: replicas: 3 # <1> (2) # ... (3) ``` -------------------------------- ### Install Cruise Control Python Client Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2019-08-08-hacking-for-cruise-control.md Installs the cruise-control-client Python package using pip. ```bash pip3 install cruise-control-client ``` -------------------------------- ### Deploy a Connect Cluster Source: https://github.com/strimzi/strimzi.github.io/blob/main/_posts/2024-11-04-managing-connector-offsets.md Deploys a Kafka Connect cluster using a Strimzi example. ```bash kubectl apply -f https://strimzi.io/examples/latest/connect/kafka-connect-build.yaml -n kafka ``` -------------------------------- ### Install Bundler Source: https://github.com/strimzi/strimzi.github.io/blob/main/README.md Install the bundler gem, which is required for managing Ruby dependencies for the website build. ```bash gem install bundler ``` -------------------------------- ### YAML Configuration Example with Callouts Source: https://github.com/strimzi/strimzi.github.io/blob/main/contributing/guide/contributing.html Provide YAML configuration examples in AsciiDoc code blocks. Use 'subs="+quotes,attributes"' for attributes and formatting, and '#' for callout numbers. ```yaml apiVersion: {KafkaApiVersion} kind: Kafka metadata: name: my-cluster spec: kafka: replicas: 3 # <1> # ... ``` -------------------------------- ### Example Kafka Cluster Configuration Source: https://github.com/strimzi/strimzi.github.io/blob/main/docs/operators/latest/full/configuring.html This example demonstrates how to configure a Kafka cluster using the Kafka custom resource, specifying broker-level configurations within the `spec.kafka.config` section. ```yaml apiVersion: kafka.strimzi.io/v1 kind: Kafka metadata: name: my-cluster spec: kafka: version: 4.2.0 metadataVersion: 4.2 # ... config: auto.create.topics.enable: "false" offsets.topic.replication.factor: 3 transaction.state.log.replication.factor: 3 transaction.state.log.min.isr: 2 default.replication.factor: 3 min.insync.replicas: 2 # ... ``` -------------------------------- ### Validate Minikube and Kubectl Installation Source: https://github.com/strimzi/strimzi.github.io/blob/main/quickstarts/minikube.md Verify that both the minikube and kubectl binaries are installed correctly by checking their versions. ```shell # Validate minikube minikube version # Validate kubectl kubectl version ```