Skip to main content
Version: Preview

Create a Kafka cluster

This document shows how to create a Kafka cluster.

Before you start

  • Install kbcli if you want to create a Kafka cluster by kbcli.

  • Install KubeBlocks by kbcli or by Helm.

  • Make sure Kafka Addon is enabled with kbcli addon list. If this Addon is not enabled, enable it first. Both kbccli and Helm options are available.

    kbcli addon list
    >
    NAME VERSION PROVIDER STATUS AUTO-INSTALL
    ...
    kafka 0.9.0 community Enabled true
    ...
  • To keep things isolated, create a separate namespace called demo throughout this tutorial.

    kubectl create namespace demo
note
  • KubeBlocks integrates Kafka v3.3.2, running it in KRaft mode.
  • You are not recommended to use kraft cluster in combined mode in a production environment.
  • The controller number suggested ranges from 3 to 5, out of complexity and availability.

Create a Kafka cluster

  1. Create a Kafka cluster.

    The cluster creation command is simply kbcli cluster create. Further, you can customize your cluster resources as demanded by using the --set flag.

    kbcli cluster create kafka mycluster -n demo

    kbcli provides more options for creating a Kafka cluster, such as setting cluster version, termination policy, CPU, and memory. You can view these options by adding --help or -h flag.

    kbcli cluster create kafka --help

    kbcli cluster create kafka -h
  2. Verify whether this cluster is created successfully.

    kbcli cluster list -n demo
    >
    NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
    mycluster demo kafka kafka-3.3.2 Delete Running Sep 27,2024 15:15 UTC+0800