rpk topic delete
Delete one or more Kafka topics.
This command deletes all requested topics, printing the success or fail status per topic.
The --regex flag (-r) opts into parsing the input topics as regular expressions and deleting any non-internal topic that matches any of the expressions. Each expression is wrapped with ^ and $, so it must match a whole topic name rather than part of one. Anchoring does not make broad expressions safe: .* still matches, and deletes, every non-internal topic.
Regex mode never deletes internal topics, which are the topics that rpk topic list shows only with -i. To delete an internal topic, name it exactly, without -r.
The topic list command accepts the same input regex format as this delete command. To check what your regular expressions will delete before actually deleting them, check the output of rpk topic list -r.
| Deleting a topic is irreversible and removes all data in the topic. |
Flags
| Value | Type | Description |
|---|---|---|
|
string |
Output format ( |
|
bool |
Treat topic names as regular expressions and delete every matching topic except internal topics. Use with caution. |
Global flags
| Value | Type | Description |
|---|---|---|
|
string |
Redpanda or |
|
stringArray |
Override |
|
bool |
Ignore |
|
string |
|
|
bool |
Enable verbose logging. |