> 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

This doc is about a 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
