Skip to main content
Version: 22.2

rpk topic create

Create topics.

All topics created with this command will have the same number of partitions, replication factor, and key/value configs.

For example,

rpk topic create -c cleanup.policy=compact -r 3 -p 20 foo bar

will create two topics, foo and bar, each with 20 partitions, 3 replicas, and the cleanup.policy=compact config option set.


rpk topic create [TOPICS...] [flags]


Value Type Description
-d, --dry-Dry run: validate the topic creation request; do not create topics.
-h, --help- Help for create.
-p, --partitionsint32Number of partitions to create per topic; -1 defaults to the cluster's default_topic_partitions (default -1).
-r, --replicasint16Replication factor (must be odd); -1 defaults to the cluster's default_topic_replications (default -1).
-c, --topic-configstringArraykey=value; Config parameters (repeatable; for example-c cleanup.policy=compact).
--brokersstringsComma-separated list of broker <ip>:<port> pairs (for example,--brokers ',,'). Alternatively, you may set the REDPANDA_BROKERSenvironment variable with the comma-separated list of broker addresses.
--configstringRedpanda config file, if not set the file will be searched for in the default locations.
--passwordstring SASL password to be used for authentication.
--sasl-mechanismstringThe authentication mechanism to use. Supported values:SCRAM-SHA-256, SCRAM-SHA-512.
--tls-certstringThe certificate to be used for TLS authentication with the broker.
--tls-enabled-Enable TLS for the Kafka API (not necessary if specifying custom certs).
--tls-keystringThe certificate key to be used for TLS authentication with the broker.
--tls-truststorestring The truststore to be used for TLS communication with the broker.
--userstring SASL user to be used for authentication.
-v, --verbose-Enable verbose logging (default false).