blog by OSO

How to avoid configuration drift across multiple Kafka environments using GitOps

Sion Smith
Sion Smith 2 August 2023
OSO guide to stopping Kafka configuration drift across environments with GitOps, white title text on a navy panel and a lime Blogs label.

At OSO we deploy self-hosted Apache Kafka for enterprise clients almost daily. The hard part at scale is not only brokers and partitions—it is keeping hundreds of application configurations consistent so a disaster-recovery failover or a promotion to production does not surprise you. This post explains how a GitOps management plane reduces that configuration drift.

What is configuration drift in Kafka environments?

Configuration drift is the gap between the state you think you have and the state that is running. On Kafka that usually means:

Drift surfaceWhat divergesTypical symptom
TopicsPartition count, retention, cleanup policy, compressionApp works in one region, fails or lags in another
AccessACLs / RBAC for producers and consumersAuth failures after failover
SchemasCompatibility mode, subject versionsConsumers cannot deserialize after promote
Quotas / throughputProduce/consume limits per clientThrottling only in production

Enterprises often run many Kafka clusters per environment—multi-tenant brokers plus active-active replicas across regions—to isolate blast radius. That topology only helps if configuration stays aligned. Drift that sits unnoticed until a DR event is a reliability debt, not a paperwork issue. For the platform patterns that sit beside GitOps, see our self-service Kafka operations guide.

Why does manual Kafka onboarding create drift?

Picture a sandwich shop that starts with custom orders, then tries to recreate each sandwich from memory when demand explodes. Errors creep in. Kafka onboarding looks the same when every new team repeats the same manual steps:

  1. Create topics and tune topic configs.
  2. Grant producer and consumer access.
  3. Register or evolve schemas.
  4. Repeat the lot in every cluster and environment.

Each repetition is a chance for a mistyped retention, a missing ACL or a schema left on the wrong subject. Multiplied across hundreds of applications, that is systematic configuration drift. Automation does not remove the need for good defaults—it makes the same good defaults land everywhere.

How does GitOps keep replicated Kafka clusters aligned?

A GitOps management plane treats Git as the only write path for cluster state. Topic definitions, access rules and schema-related config live in YAML. A Kubernetes operator (or equivalent controller) applies that desired state so both sides of an active-active pair receive the same change.

When someone needs a new topic, they change the YAML in Git. The operator creates the topic with identical settings on each replicated cluster. The change is only considered complete when it has persisted on both; otherwise it rolls back. That transactional habit stops the classic failure mode: primary updated, replica forgotten, failover broken.

This is governance, not a substitute for broker monitoring. You still watch under-replicated partitions, consumer lag and disk. GitOps answers a different question: “Are we running the topic and ACL estate we intended?” Our Kafka Cruise Control guide covers rebalancing once the declared topology is correct.

How do you stop drift across Dev, Test and Prod?

Aligning replicas is only half the problem. Environments still diverge if engineers edit Prod directly.

We use one Git branch per environment. Branches are segmented and are not merged into each other:

BranchWho can change itPurpose
Dev / TestApplication teamsCreate and iterate on topic, ACL and schema config
ProdControlled promotion onlyHolds the released snapshot for higher environments

A Promote and Release automation snapshots the approved development configuration and pushes that release into the production branch. New work is always tested in development first; only then is a release created and promoted. If testing fails, you roll back with the normal Git history instead of hunting hand-made fixes on the brokers.

Useful extras in that promote step:

  • Dry run — compare the release with the live higher environment and list what would change, so release engineers can spot destructive diffs before apply.
  • Scaling factors — adjust partition counts or throughput envelopes for higher environments (for example via Kustomize overlays) without rewriting the base definition by hand.

That pattern removes repetitive copy-paste operations and keeps Dev → Prod movement auditable.

What benefits does GitOps give Kafka teams?

Centralising configuration management for Kafka clusters tends to:

  • Cut redundant manual topic and ACL work.
  • Reduce inconsistency between regions and environments.
  • Give developers a clear, reviewable change path.
  • Strengthen isolation and shrink blast radius when something is wrong—because you can see and revert the declared state.

We have discussed open-sourcing parts of the Promote and Release automation. If you want help adopting a similar GitOps model on your platform, contact OSO or explore Kafka services and fully managed Kafka.

Key takeaway: Avoid Kafka configuration drift with GitOps: identical topic, ACL and schema changes from Git on every replica, one branch per environment, and promote-and-release with dry-run before production.

Frequently asked questions

What is configuration drift in Apache Kafka?

Configuration drift is when the running Kafka estate (topics, ACLs, schemas, quotas) no longer matches the intended or peer environment—often after manual changes on one cluster that never landed on its replica or in production.

How does GitOps prevent Kafka configuration drift?

Git holds the desired state. Controllers apply the same YAML to every cluster that should match, so humans are not the source of truth for each broker. Reviews and history live in Git instead of undocumented CLI sessions.

Why use one Git branch per Kafka environment?

Separate branches stop Dev experiments merging straight into Prod. Promotion becomes an explicit release snapshot with checks, rather than a merge that carries half-finished topic definitions.

What should a promote-and-release step check?

At minimum: a dry-run diff against the target environment, validation that required fields exist, and any environment-specific overlays (partitions, quotas). Prefer failing closed if a replica apply does not confirm.

Does GitOps replace Kafka cluster monitoring?

No. GitOps governs declared configuration. You still need metrics and alerts for broker health, lag, disk and ISR. Use both: GitOps for consistency, monitoring for runtime truth.

Keep Kafka configs consistent

Talk to OSO's Kafka engineers about GitOps topic, ACL and schema management across multi-cluster and multi-environment platforms.

CONTACT US
OSO
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.