rpk topic create
Create one or more Kafka topics with configurable partitions, replication factor, and topic-level settings.
|
Starting in Redpanda v25.3, several topic properties support enhanced tristate behavior. Properties like |
For more information about topics, see rpk topic describe.
Examples
This section provides examples of how to use rpk topic create.
Create a topic
Create a topic named my-topic
rpk topic create my-topic
Output:
TOPIC STATUS
my-topic OK
Create multiple topics
Create two topics (my-topic-1, my-topic-2) at the same time with one command
rpk topic create my-topic-1 my-topic-2
Output:
TOPIC STATUS
my-topic-1 OK
my-topic-2 OK
Set a topic property
Create topic my-topic-3 with the topic property cleanup.policy=compact
rpk topic create my-topic-3 -c cleanup.policy=compact
Output:
TOPIC STATUS
my-topic-3 OK
Create topic with multiple partitions
Create topic my-topic-4 with 20 partitions
rpk topic create my-topic-4 -p 20
Output:
TOPIC STATUS
my-topic-4 OK
Flags
| Value | Type | Description |
|---|---|---|
|
bool |
Validate the topic creation request without actually creating the topic. Useful for testing configuration. |
|
bool |
Only create the topic if it does not already exist. |
|
int32 |
Number of partitions for the topic. More partitions enable higher parallelism but increase resource usage. Default is 1. |
|
int16 |
Replication factor (must be odd); -1 defaults to the cluster’s default_topic_replications. |
|
stringArray |
Topic configuration properties in the format |
Global flags
| Value | Type | Description |
|---|---|---|
|
string |
Redpanda or |
|
stringArray |
Override |
|
bool |
Ignore |
|
string |
|
|
bool |
Enable verbose logging. |
| For the full list of properties, see Topic Properties |