> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/platform/guides/operations-guide/kafka-troubleshooting-guide.md).

# Kafka Troubleshooting Guide

## Pre-reads

<https://kafka.apache.org/intro>\
<https://zookeeper.apache.org/>

### Pre-requisites <a href="#prerequisites" id="prerequisites"></a>

* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) is a CLI to connect to the kubernetes cluster from your machine
* [Install Visualstudio](https://code.visualstudio.com/download) IDE Code for better code/configuration editing capabilities
* Git

### Status check of Kafka Broker's

Using the below command you can able list down the Kafka brokers and their status

`kubectl get pods -n kafka-cluster`

* If Kafka brokers are in crashloopbackoff or Error status

  * Describe the brokers and look for error

    `kubectl describe kafka-v2-0 -n kafka-cluster`

  `kubectl describe kafka-v2-1 -n kafka-cluster`

  `kubectl describe kafka-v2-2 -n kafka-cluster`
* Check Kafka broker's logs for error

  `kubectl logs -f kafka-v2-0 -n kafka-cluster`

  `kubectl logs -f kafka-v2-1 -n kafka-cluster`

  `kubectl logs -f kafka-v2-2 -n kafka-cluster`
* If brokers are in crashloopbackoff due to disk space issues, follow the below document for the cleanup of the logs
  * [Cleanup of Kafka logs](https://core.digit.org/guides/operations-guide/cleanup-kafka-logs)

### Status check of Zookeeper

Ensure Zookeeper pods are running without any errors in order to run Kafka brokers without a hitch

* If Zookeeper pods are in crashloopbackoff or Error status, Use the below commands to check the error
  * Describe the Zookeeper and look for error

    `kubectl describe zookeeper-v2-0 -n zookeeper-cluster`

    `kubectl describe zookeeper-v2-1 -n zookeeper-cluster`

    `kubectl describe zookeeper-v2-2 -n zookeeper-cluster`
  * Check Kafka broker's logs for error

    `kubectl logs -f zookeeper-v2-0 -n zookeeper-cluster`

    `kubectl logs -f zookeeper-v2-1 -n zookeeper-cluster`

    `kubectl logs -f zookeeper-v2-2 -n zookeeper-cluster`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digit.org/platform/guides/operations-guide/kafka-troubleshooting-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
