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
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
| Flag | Type | Default | Description |
|---|---|---|---|
--filename, -f | stringArray | manifest file or directory (repeatable; use - for stdin) | |
--recursive, -R | bool | recurse into directories given to -f | |
--cluster-config-file, -c | stringArray | KafkaCluster config file or directory (repeatable) | |
--cluster | string | select/filter a single cluster by name | |
--output, -o | string | human | output format; only human is supported by this command |
--dry-run | bool | show what would be corrected without changing anything | |
--topic | stringArray | limit the run to this declared Kafka topic (repeatable; default: every declared topic) |
Global flags
| Flag | Type | Default | Description |
|---|---|---|---|
--log-level | string | warn | log verbosity on stderr: error, warn, info, or debug |
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
| Code | Meaning |
|---|---|
0 | Every topic is balanced, corrected, skipped or deferred. |
2 | Validation, configuration or connectivity error, a --topic that is not declared, a failed topic, a failed election, or a cancelled run. |