Quick Start with KRaft

Deploy Confluent Platform with KRaft using Confluent for Kubernetes by following these steps.

Prerequisites

  • A Kubernetes cluster conforming to one of the supported versions.

  • kubectl installed, initialized, with the context set. You must also have the kubeconfig file configured for your cluster.

  • Helm 3 installed.

  • Access to the Confluent for Kubernetes bundle.

  • A Kubernetes cluster with a default dynamic storage provisioner enabled.

Step 1: Set the quick start home directory

Set an environment variable to point to the location of the quick start custom resource (CR) files.

export QUICKSTART_HOME="https://raw.githubusercontent.com/confluentinc/confluent-kubernetes-examples/master/quickstart-deploy/kraft-quickstart"

Step 2: Create a namespace

  1. Create the namespace:

    kubectl create namespace confluent
    

    Expected: Your terminal prints the success message namespace/confluent created.

  2. Set the namespace as the default for your Kubernetes context:

    kubectl config set-context --current --namespace confluent
    

    Expected: Your terminal prints Context "<your-context-name>" modified.

Step 3: Install Confluent for Kubernetes

  1. Add the Confluent for Kubernetes Helm repository:

    helm repo add confluentinc https://packages.confluent.io/helm
    

    Expected: Your terminal prints "confluentinc" has been added to your repositories.

  2. Update the Helm repository:

    helm repo update
    

    Expected: Your terminal prints Update Complete. Happy Helming!

  3. Install Confluent for Kubernetes:

    helm upgrade --install \
      confluent-operator confluentinc/confluent-for-kubernetes
    

    Expected: Your terminal prints Release "confluent-operator" does not exist. Installing it now., followed by STATUS: deployed.

  4. Check that the CFK pod starts:

    kubectl get pods
    

    Expected: The confluent-operator pod shows 1/1 under READY and Running under STATUS.

Step 4: Install Confluent Platform

  1. Deploy the KRaft controller and the Apache Kafka® brokers:

    kubectl apply -f $QUICKSTART_HOME/confluent-platform-c3++.yaml
    

    Expected: One <kind>.platform.confluent.io/<name> created line per resource, for example, kraftcontroller.platform.confluent.io/kraftcontroller created.

  2. Install the sample producer application and topic:

    kubectl apply -f $QUICKSTART_HOME/producer-app-data.yaml
    

    Expected: Your terminal prints secret/kafka-client-config created, statefulset.apps/elastic created, service/elastic created, and kafkatopic.platform.confluent.io/elastic-0 created.

  3. Wait until all the Confluent Platform components deploy and run:

    kubectl get pods
    

    Expected: Every pod shows a matching ready count, such as 1/1, under READY and Running under STATUS. This can take a few minutes.

    In this quick start, the following components are being deployed: KRaft controller, Apache Kafka®, Connect, Schema Registry, ksqlDB, REST Proxy, Control Center.

Step 5: View Control Center

Use Control Center to monitor Confluent Platform, and see the created topic and data.

  1. Set up port forwarding to Control Center web UI from your local machine:

    kubectl port-forward controlcenter-0 9021:9021
    

    Expected: Your terminal prints Forwarding from 127.0.0.1:9021 -> 9021.

  2. Browse to Control Center at:

    http://localhost:9021

    Expected: The Control Center UI loads in your browser.

  3. Check that the elastic-0 topic is created and the messages are being produced to the topic.

  4. Optionally, you can try other tasks, such as adding or uploading your connectors. For details, see Install connector plugin.

Step 6: Tear down

  1. Shut down the sample producer application:

    kubectl delete -f $QUICKSTART_HOME/producer-app-data.yaml
    

    Expected: Your terminal prints secret "kafka-client-config" deleted from <namespace> namespace, statefulset.apps "elastic" deleted from <namespace> namespace, service "elastic" deleted from <namespace> namespace, and kafkatopic.platform.confluent.io "elastic-0" deleted from <namespace> namespace.

  2. Shut down the Confluent Platform cluster:

    kubectl delete -f $QUICKSTART_HOME/confluent-platform-c3++.yaml
    

    Expected: One <kind>.platform.confluent.io "<name>" deleted from <namespace> namespace line per resource.

  3. Shut down the CFK when all the Confluent Platform components shut down:

    helm uninstall confluent-operator
    

    Expected: Your terminal prints release "confluent-operator" uninstalled.

  4. Delete the namespace:

    kubectl delete namespace confluent
    

    Expected: Your terminal prints namespace "confluent" deleted.

Next steps

To install and use the Confluent kubectl plugin, see Quick Start to Install Confluent kubectl Plugin.