# Specify Broker Addresses for rpk

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [streaming-full.txt](https://docs.redpanda.com/streaming-full.txt)

---
title: Specify Broker Addresses for rpk
latest-redpanda-tag: v24.3.9
latest-console-tag: v3.7.3
latest-operator-version: v26.1.4
# EOL = End-of-Life (support lifecycle status)
page-is-nearing-eol: "false"
page-is-past-eol: "true"
page-eol-date: December 3, 2025
latest-connect-version: 4.93.0
docname: broker-admin
page-component-name: streaming
page-version: "24.3"
page-component-version: "24.3"
page-component-title: Streaming
page-relative-src-path: broker-admin.adoc
page-edit-url: https://github.com/redpanda-data/docs/edit/v/24.3/modules/get-started/pages/broker-admin.adoc
description: Learn how and when to specify Redpanda broker addresses for <code>rpk</code> commands, so <code>rpk</code> knows where to run Kafka-related commands.
page-git-created-date: "2023-07-24"
page-git-modified-date: "2024-07-25"
support-status: past end-of-life
---

<!-- Source: https://docs.redpanda.com/streaming/24.3/get-started/broker-admin.md -->

For `rpk` to know where to run Kafka-related commands, you must provide the broker addresses for each broker of a Redpanda cluster. You can specify these addresses as IP addresses or as hostnames, using any of these methods:

-   Command line flag (`-X brokers`)

-   Environment variable setting (`RPK_BROKERS`)

-   Configuration file setting in `redpanda.yaml` (`rpk.kafka_api.brokers`)


Command line flag settings take precedence over environment variable settings and configuration file settings. If the command line does not contain the `-X brokers` settings, the environment variable settings are used. If the environment variables are not set, the values in the configuration file are used.

## [](#command-line-flags)Command line flags

Broker addresses are required for communicating with the Kafka API. Provide these addresses with the `-X brokers` flag for commands related to Kafka broker tasks, such as [`rpk topic create`](https://docs.redpanda.com/streaming/24.3/reference/rpk/rpk-topic/rpk-topic-create/), [`rpk topic produce`](https://docs.redpanda.com/streaming/24.3/reference/rpk/rpk-topic/rpk-topic-produce/), and [`rpk topic consume`](https://docs.redpanda.com/streaming/24.3/reference/rpk/rpk-topic/rpk-topic-consume/).

The following table shows which `rpk` commands require the `-X brokers` flag.

| Command | Address flag required |
| --- | --- |
| rpk cluster info | -X brokers |
| rpk cluster metadata | -X brokers |
| rpk group | -X brokers |
| rpk security acl | -X brokers |
| rpk topic | -X brokers |

## [](#environment-variable-settings)Environment variable settings

Environment variable settings last for the duration of the shell session, or until you set the variable to a different setting. Configure the environment variable `RPK_BROKERS` for broker addresses, so you don’t have to include the `-X brokers` flag each time you run an `rpk` command.

For example, to configure three brokers on a single machine running on localhost:

```bash
export RPK_BROKERS="192.168.72.34:9092,192.168.72.35:9092,192.168.72.36.9092"
```

## [](#configuration-file-settings)Configuration file settings

As each Redpanda broker starts up, a `redpanda.yaml` configuration file is automatically generated for that broker. This file contains a section for `rpk` settings, which includes Kafka API settings.

The `kafka_api` section contains the address and port for each broker. The default address is `0.0.0.0`, and the default port is 9092. You can edit this line and replace it with the IP addresses of your Redpanda brokers.

The following example shows the addresses and port numbers for three brokers.

```yaml
rpk:
  kafka_api:
    brokers:
    - 192.168.72.34:9092
    - 192.168.72.35:9092
    - 192.168.72.36.9092
```

> 📝 **NOTE**
>
> If you do not update the default addresses in the `redpanda.yaml` file, you must provide the required addresses on the command line or by setting the corresponding environment variable.