retention.bytes Required Alongside retention.ms
Every non-compacted topic must declare a retention.bytes cap.
Rationale
Time-only retention is unbounded in disk. A 10x traffic spike fills the broker before the time window expires and the cluster goes read-only. Setting both makes the topic self-defending: whichever limit hits first triggers cleanup. Matches the `partitions x retention.bytes` capacity model platform teams use to plan disk.
Pattern
cleanup.policy contains "delete" → retention.bytes set and > 0
Examples
cleanup.policy=delete + retention.ms=604800000 + retention.bytes=10737418240
cleanup.policy=compact (rule skipped)
cleanup.policy=delete + retention.bytes unset → unbounded disk growth
Parameters
| Name | Default | Description |
|---|---|---|
min_bytes |
1 |
Minimum acceptable retention.bytes value. |
Governs
This policy relates to the following Kafka configuration keys:
Implementation
Drop this YAML into Conduktor Console as a ResourcePolicy, then link it from an ApplicationInstance, Application, or KafkaCluster.
Conduktor ResourcePolicy
# Conduktor self-service ResourcePolicy --- apiVersion: self-serve/v1 kind: ResourcePolicy metadata: name: retention-bytes-required spec: targetKind: Topic description: delete-policy topics must declare retention.bytes > 0 rules: - condition: '!("cleanup.policy" in spec.configs) || !spec.configs["cleanup.policy"].contains("delete") || ("retention.bytes" in spec.configs && int(string(spec.configs["retention.bytes"])) > 0)' errorMessage: "retention.bytes must be set (>0) on delete-policy topics — time-only retention is unbounded in disk"
Related policies
Try Conduktor Console
Enforce policies like this across your team — central audit history, pre-commit guardrails, ApplicationInstance bindings. 5-min Docker install.
Get Started →