Skip to content
Kafka · Worked example

Use case: one Kafka platform for many teams, run as code

A worked example with a made-up bank: multi-tenant Kafka with naming conventions, prefixed ACLs, quotas and a GitOps workflow, so a team gets a topic by pull request and the platform team stops being a ticket queue.

When Kafka succeeds in an organisation, the platform team becomes a bottleneck. Every new topic, every ACL change and every new service account is a ticket. The tickets take days, so teams create topics with whatever defaults they can get away with, or run their own clusters. Within a couple of years there are several clusters, no consistent naming, and nobody can say who is allowed to read the payments topics.

This worked example shows how we set up a shared, multi-tenant Kafka platform that teams can use without waiting, and the platform team can still govern. The bank and its teams are made up.

Example · Granite Harbor Bank, a made-up regional bank

The starting point

Granite Harbor runs one central Kafka platform for card payments, fraud, digital banking and data teams. The platform team of four handles around thirty access and topic requests a week by hand. Some topics have no known owner; several service accounts have broad wildcard permissions granted during incidents and never removed.

1. Tenancy by naming

Everything starts with a naming convention, because naming is what makes the rest of the controls simple. Granite Harbor uses <domain>.<dataset>.<event>.<version>, where the domain is the owning team's area: payments., fraud., digital.. Consumer groups and service accounts follow the same prefixes. A team owns its prefix.

2. Access by prefix, least privilege by default

  • Prefixed ACLs (or role bindings on Confluent) give a team's producers write access to their own prefix with one rule, instead of one rule per topic.
  • Cross-team reads are explicit: the fraud team's consumer is granted read on one named payments topic and its own consumer group, nothing wider.
  • One service account per application, never shared, so access can be revoked for one service without affecting others, and audit logs say which application did what.
  • No wildcards outside the platform team, enforced by the pipeline below rather than by review alone.

3. Quotas, so one tenant can't starve the rest

Kafka quotas limit produce and fetch throughput (bytes per second) and request time per client or user. Granite Harbor sets a default quota for every service account and raises it for named high-volume producers, so a misbehaving batch job slows itself down instead of the card authorisation stream.

4. Everything as code, applied by a pipeline

Each team has a file in a platform repository describing its topics, schemas and access:

# payments-team/topics.yaml - reviewed by the payments team, applied by the platform pipeline
owner: payments-team
topics:
  - name: payments.card-auth.decided.v1
    partitions: 12
    replication_factor: 3
    config:
      retention.ms: 604800000        # 7 days
      min.insync.replicas: 2
    schema: avro/card_auth_decided.avsc
access:
  - principal: svc-card-auth          # producer
    prefix: payments.card-auth.
    operations: [write, describe]
  - principal: svc-fraud-scoring      # consumer from another team
    topic: payments.card-auth.decided.v1
    group: fraud-scoring
    operations: [read, describe]

An illustrative topics file. The exact format depends on the tool (a Terraform provider, a Kubernetes operator's custom resources, or a purpose-built tool); the idea is the same.

A change is a pull request. CI checks it against the platform's rules: names follow the convention and sit inside the team's prefix, partition counts and retention are within limits, replication factor and min.insync.replicas meet the minimum, ACLs don't use wildcards, the schema is compatible with the registered one. After review and merge, a pipeline applies it with the platform's credentials; nobody applies changes by hand. A scheduled job compares the cluster with the repository and reports, or reverts, drift.

Ownership becomes a fact. Because every topic is created from a team's file, every topic has an owner in version control, and the history of who requested access to what, and who approved it, is the repository's history.

One shared cluster or several?

Shared does not have to mean one cluster. The trade-offs we weigh with teams:

OptionStrengthsCosts
One shared clusterSimplest to govern; cross-team data sharing needs no replicationNoisy neighbours need quotas; one upgrade affects everyone
A cluster per criticality tierCritical streams isolated from batch and experimentationData crossing tiers needs replication
A cluster per teamStrong isolation and independent upgradesMore clusters to run; governance repeated many times

The same repository, rules and pipeline can manage any of these. The decision is about isolation and cost, not about tooling.

Incidents still need fast access

The strongest argument for hand-granted wildcards is speed during an incident. A reviewed pull request can still be fast if the platform defines an emergency path in advance: a pre-approved change type, a small set of people who can approve it at any hour, and an expiry date in the file itself so the grant is removed automatically when it lapses.

5. What the platform team does now

BeforeAfter
Creates topics and ACLs from ticketsMaintains the rules CI enforces
Grants emergency wildcardsGrants scoped access through a reviewed PR, even in incidents
Guesses topic ownersReads them from the repository
Investigates noisy neighboursSets and tunes quotas
Example · the first quarter at Granite Harbor

Rolling it out

The platform team first imported every existing topic and ACL into the repository as-is, assigning owners team by team; topics nobody claimed in a month were flagged for deletion. Then CI rules were switched on in warning mode for two weeks, and enforced after that. The broad wildcard grants were replaced with prefixed ACLs, one application at a time, with each team testing its service before the old grant was removed.

All names and details are fictional.

For the security building blocks behind the ACLs, see our guide to securing Kafka; for the topic decisions CI checks, designing topics and partitions.

Questions we are often asked

Which tool should manage the topics files?

It depends on how you run Kafka. On Kubernetes, operators such as Strimzi or Confluent for Kubernetes provide custom resources for topics and users. Elsewhere, Terraform providers and purpose-built GitOps tools fill the same role. We choose with your platform team rather than impose one.

Can usage be charged back to teams?

Because every topic and service account carries a team prefix, throughput and storage metrics can be grouped by team. Whether to turn that into chargeback is an organisational decision; the data to support it is there.

What about teams that already run their own clusters?

They can adopt the same repository and rules for their own clusters first, and move onto the shared platform later, when the migration has a clear benefit for them.

Planning a Kafka migration or a platform clean-up?

The Kafka POD assesses, builds, migrates and hardens Kafka on Confluent, Amazon MSK, Redpanda or Apache Kafka, inside your environment, in a typical 12 weeks.

Kafka POD

Keep reading

Back to blog