Monedula

monedula-gitops rebalance-leaders

Spread the preferred leaders of declared topics across the cluster's racks. Usage and flags for monedula-gitops rebalance-leaders.

Reference 12 of 22

Reference for monedula-gitops v1.3.0

Updated 3 December 2026

On this page
usage
monedula-gitops rebalance-leaders [flags]

For each declared topic whose preferred leaders are skewed, reorders the replicas within a partition and runs a preferred leader election. The brokers that hold a partition never change, so no data moves. A topic with a reassignment in flight is deferred. apply does this for the topics it creates or grows, and the operator does it continuously; this command is for topics that already exist. The cluster must list defaults.replicaPlacement.leaderDistribution.racks.

This command can change external state. Check the flags that gate it before running it against production.

Flags

FlagTypeDefaultDescription
--filename, -fstringArray manifest file or directory (repeatable; use - for stdin)
--recursive, -Rbool recurse into directories given to -f
--cluster-config-file, -cstringArray KafkaCluster config file or directory (repeatable)
--clusterstring select/filter a single cluster by name
--output, -ostring human output format; only human is supported by this command
--dry-runbool show what would be corrected without changing anything
--topicstringArray limit the run to this declared Kafka topic (repeatable; default: every declared topic)

Global flags

FlagTypeDefaultDescription
--log-levelstringwarnlog verbosity on stderr: error, warn, info, or debug

Examples

examples
monedula-gitops rebalance-leaders -f ./topics --cluster-config-file ./clusters/prod-mrc.yaml --dry-run
monedula-gitops rebalance-leaders -f ./topics --cluster-config-file ./clusters/prod-mrc.yaml
monedula-gitops rebalance-leaders -f ./topics --cluster-config-file ./clusters/prod-mrc.yaml --topic orders --topic payments

Exit codes

CodeMeaning
0Every topic is balanced, corrected, skipped or deferred.
2Validation, configuration or connectivity error, a --topic that is not declared, a failed topic, a failed election, or a cancelled run.