rpk -X
Use rpk -X flag to override any rpk-specific configuration option.
Every configuration flag for rpk is a key=value option following the -X flag. For example, rpk -X tls.enabled=true enables TLS for the Kafka API.
Every -X option can be translated into an environment variable by prefixing with RPK_ and replacing periods (.) with underscores (_). For example, the flag tls.enabled has the equivalent environment variable RPK_TLS_ENABLED.
|
|
Configuration priority
rpk resolves configuration values in the following priority order where higher priority options override lower priority ones:
-
Command-line flags (including
-Xoptions): Applies to current command only -
Environment variables:
RPK_*environment variables lasts for shell session -
rpk profile (
rpk.yaml): Persistent across sessions (recommended) -
Redpanda configuration (
redpanda.yamlrpk section): System-wide defaults
Environment variables
RPK_* environment variables
Every -X option has a corresponding RPK_* environment variable. Convert by prefixing with RPK_ and replacing dots with underscores:
-X Option |
Environment Variable |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Duration format
Duration values use Go’s standard duration format. A duration string is a sequence of decimal numbers with unit suffixes:
-
ns= nanoseconds -
usorµs= microseconds -
ms= milliseconds -
s= seconds -
m= minutes -
h= hours
Examples: 30s, 1m30s, 2h, 500ms, 1h15m30s
You can combine multiple units: 2h45m30s means 2 hours, 45 minutes, and 30 seconds.
Configuration examples
To persist configuration across sessions, use a rpk profile:
Create a profile:
rpk profile create <profile-name> \
--set brokers=<broker1:port>,<broker2:port> \
--set user=<username> \
--set pass=<password> \
--set sasl.mechanism=<mechanism> \
--set tls.enabled=true \
--description "<profile-description>"
Use the profile for commands:
rpk topic list --profile <profile-name>
For temporary use or automation scripts, set environment variables:
export RPK_BROKERS="<broker1:port>,<broker2:port>"
export RPK_USER="<username>"
export RPK_PASS="<password>"
export RPK_SASL_MECHANISM="<mechanism>"
export RPK_TLS_ENABLED="true"
Options
The following options are available:
brokers
A comma-delimited list of broker host:port pairs to connect to the Kafka API.
Type: string
Default: localhost:9092
Example: brokers=127.0.0.1:9092,localhost:9094
Usage:
rpk topic list -X brokers=<host:port>,<host:port>
tls.enabled
A boolean that enables rpk to speak TLS to your broker’s Kafka API listeners.
You can use this if you have well known certificates set up on your Kafka API. If you use mTLS, specifying mTLS certificate filepaths automatically opts into tls.enabled.
Type: boolean
Default: false
Example: tls.enabled=true
Usage:
rpk topic list -X tls.enabled=<value>
tls.insecure_skip_verify
A boolean that disables rpk from verifying the broker’s certificate chain.
Type: boolean
Default: false
Example: tls.insecure_skip_verify=true
Usage:
rpk topic list -X tls.insecure_skip_verify=<value>
tls.ca
A filepath to a PEM-encoded CA certificate file to talk to your broker’s Kafka API listeners with mTLS.
You may need this option if your listeners are using a certificate by a well known authority that is not bundled with your operating system.
Type: string
Default: ""
Example: tls.ca=/path/to/ca.pem
Usage:
rpk topic list -X tls.ca=<filepath>
tls.cert
A filepath to a PEM-encoded client certificate file to talk to your broker’s Kafka API listeners with mTLS.
Type: string
Default: ""
Example: tls.cert=/path/to/cert.pem
Usage:
rpk topic list -X tls.cert=<filepath>
tls.key
A filepath to a PEM-encoded client key file to talk to your broker’s Kafka API listeners with mTLS.
Type: string
Default: ""
Example: tls.key=/path/to/key.pem
Usage:
rpk topic list -X tls.key=<filepath>
sasl.mechanism
The SASL mechanism to use for authentication.
Type: string
Default: ""
Acceptable values: SCRAM-SHA-256, SCRAM-SHA-512, PLAIN
With Redpanda, the Admin API can be configured to require basic authentication with your Kafka API SASL credentials. This defaults to SCRAM-SHA-256 if no mechanism is specified.
|
Example: sasl.mechanism=SCRAM-SHA-256
Usage:
rpk topic list -X sasl.mechanism=<mechanism>
user
The SASL username to use for authentication. It’s also used for the Admin API if you have configured it to require basic authentication.
Type: string
Default: ""
Example: user=myusername
Usage:
rpk topic list -X user=<username>
pass
The SASL password to use for authentication. It’s also used for the Admin API if you have configured it to require basic authentication.
Type: string
Default: ""
Example: pass=mypassword
Usage:
rpk topic list -X pass=<password>
admin.hosts
A comma-delimited list of admin hosts to connect to.
Type: string
Default: localhost:9644
Example: admin.hosts=192.168.1.1:9644,192.168.1.2:9644
admin.tls.enabled
A boolean that enables rpk to speak TLS to your broker’s Admin API listeners.
You can use this if you have well known certificates set up on your Admin API. If you use mTLS, specifying mTLS certificate filepaths automatically opts into admin.tls.enabled.
Type: boolean
Default: false
Example: admin.tls.enabled=true
Usage:
rpk cluster info -X admin.tls.enabled=<value>
admin.tls.insecure_skip_verify
A boolean that disables rpk from verifying the broker’s certificate chain.
Type: boolean
Default: false
Example: admin.tls.insecure_skip_verify=true
Usage:
rpk cluster info -X admin.tls.insecure_skip_verify=<value>
admin.tls.ca
A filepath to a PEM-encoded CA certificate file to talk to your broker’s Admin API listeners with mTLS. You may also need this if your listeners are using a certificate by a well known authority that is not yet bundled with your operating system.
Type: string
Default: ""
Example: admin.tls.ca=/path/to/ca.pem
Usage:
rpk cluster info -X admin.tls.ca=<filepath>
admin.tls.cert
A filepath to a PEM-encoded client certificate file to talk to your broker’s Admin API listeners with mTLS.
Type: string
Default: ""
Example: admin.tls.cert=/path/to/cert.pem
Usage:
rpk cluster info -X admin.tls.cert=<filepath>
admin.tls.key
A filepath to a PEM-encoded client key file to talk to your broker’s Admin API listeners with mTLS.
Type: string
Default: ""
Example: admin.tls.key=/path/to/key.pem
Usage:
rpk cluster info -X admin.tls.key=<filepath>
registry.hosts
A comma-delimited list of Schema Registry hosts to connect to.
Type: string
Default: localhost:8081
Example: registry.hosts=192.168.1.1:8081,192.168.1.2:8081
Usage:
rpk registry schema list -X registry.hosts=<host:port>,<host:port>
registry.tls.enabled
A boolean that enables rpk to use TLS with your broker’s Schema Registry API listeners.
You can use this if you have well known certificates set up on your Schema Registry API. If you use mTLS, specifying mTLS certificate filepaths automatically opts into registry.tls.enabled.
Type: boolean
Default: false
Example: registry.tls.enabled=true
Usage:
rpk registry schema list -X registry.tls.enabled=<value>
registry.tls.insecure_skip_verify
A boolean that disables rpk from verifying the broker’s certificate chain.
Type: boolean
Default: false
Example: registry.tls.insecure_skip_verify=true
Usage:
rpk registry schema list -X registry.tls.insecure_skip_verify=<value>
registry.tls.ca
A filepath to a PEM-encoded CA certificate file to talk to your broker’s Schema Registry API listeners with mTLS.
Type: string
Default: ""
Example: registry.tls.ca=/path/to/ca.pem
Usage:
rpk registry schema list -X registry.tls.ca=<filepath>
registry.tls.cert
A filepath to a PEM-encoded client certificate file to talk to your broker’s Schema Registry API listeners with mTLS.
Type: string
Default: ""
Example: registry.tls.cert=/path/to/cert.pem
Usage:
rpk registry schema list -X registry.tls.cert=<filepath>
registry.tls.key
A filepath to a PEM-encoded client key file to talk to your broker’s Schema Registry API listeners with mTLS.
Type: string
Default: ""
Example: registry.tls.key=/path/to/key.pem
Usage:
rpk registry schema list -X registry.tls.key=<filepath>
cloud.client_id
An OAuth client ID to use for authenticating with the Redpanda Cloud API.
Type: string
Default: ""
Example: cloud.client_id=abcdef123456
Usage:
rpk cloud cluster list -X cloud.client_id=<client-id>
cloud.client_secret
An OAuth client secret to use for authenticating with the Redpanda Cloud API.
Type: string
Default: ""
Example: cloud.client_secret=secretvalue789
Usage:
rpk cloud cluster list -X cloud.client_secret=<client-secret>
globals.prompt
A format string to use for the default prompt. See rpk profile prompt for more information.
Type: string
Default: bg-red "%n"
Example: globals.prompt="%n"
Usage:
rpk profile edit -X globals.prompt=<format-string>
globals.no_default_cluster
A boolean that disables rpk from communicating to localhost:9092 if no other cluster is specified.
Type: boolean
Default: false
Example: globals.no_default_cluster=true
Usage:
rpk topic list -X globals.no_default_cluster=<value>
globals.command_timeout
Sets a timeout for all commands issued through rpk.
Type: duration
Default: 30s
Example: globals.command_timeout=30s
globals.dial_timeout
A duration that rpk will wait for a connection to be established before timing out.
Type: duration
Default: 3s
Example: globals.dial_timeout=3s
Usage:
rpk topic list -X globals.dial_timeout=<duration>
globals.request_timeout_overhead
A duration that limits how long rpk waits for responses.
Type: duration
Default: 10s
|
For example, |
Example: globals.request_timeout_overhead=5s
Usage:
rpk topic list -X globals.request_timeout_overhead=<duration>
globals.retry_timeout
This timeout specifies how long rpk will retry Kafka API requests.
Type: duration
Default: 30s
This timeout is evaluated before any backoff:
-
If a request fails,
rpkfirst checks if the retry timeout has elapsed.-
If the retry timeout has elapsed,
rpkstops retrying. -
Otherwise,
rpkwaits for the backoff and then retries.
-
Example: globals.retry_timeout=11s
Usage:
rpk topic list -X globals.retry_timeout=<duration>
globals.fetch_max_wait
This timeout specifies the maximum duration that brokers will wait before replying to a fetch request with available data.
Type: duration
Default: 5s
Example: globals.fetch_max_wait=5s
Usage:
rpk topic consume my-topic -X globals.fetch_max_wait=<duration>
globals.kafka_protocol_request_client_id
This string value is the client ID that rpk uses when issuing Kafka protocol requests to Redpanda. This client ID shows up in Redpanda logs and metrics. Changing it can be useful if you want to have your own rpk client stand out from others that are also interacting with the cluster.
Type: string
Default: rpk
Example: globals.kafka_protocol_request_client_id=my-rpk-client
Usage:
rpk topic list -X globals.kafka_protocol_request_client_id=<client-id>