Running Kafka on Kubernetes and in the Cloud: Strimzi, Confluent Cloud, MSK and Sizing

Apache Kafka 18 min min read Updated: Nov 17, 2026 Advanced
Running Kafka on Kubernetes and in the Cloud: Strimzi, Confluent Cloud, MSK and Sizing
Advanced Topic 2 of 2

Options for Running Kafka

OptionYou manageGood forWatch out for
Self-managed on VMsEverything: OS, Kafka, upgrades, security, monitoringFull control, stable on-premises setupsOperational effort, on-call
Kubernetes with an operator (Strimzi)Cluster resources through YAML. The operator handles rolling updates and certificatesTeams already on Kubernetes, GitOps workflowsStorage and networking design, broker pods are stateful
Managed Kafka (Confluent Cloud, Amazon MSK, Aiven, Redpanda Cloud and others)Topics, clients, access. Provider runs brokersTeams that want to focus on applicationsCost at scale, vendor features and limits, network setup (private links)
Kafka-compatible services (Azure Event Hubs, others)LittleCloud-native integrationCheck which Kafka APIs and features are supported (transactions, compaction, Streams)

Strimzi: Kafka on Kubernetes

Strimzi is a CNCF project with an operator that runs Kafka (in KRaft mode in current versions), Kafka Connect, MirrorMaker 2 and the Kafka bridge using custom resources. You declare the cluster in YAML and the operator creates StatefulSets or pods, services, certificates and performs safe rolling updates.

bash kubectl create namespace kafka helm repo add strimzi https://strimzi.io/charts/ helm install strimzi-operator strimzi/strimzi-kafka-operator -n kafka kubectl get pods -n kafka # strimzi-cluster-operator Running
yaml # node pool: describes broker (and controller) nodes and their storage apiVersion: kafka.strimzi.io/v1beta2 kind: KafkaNodePool metadata: name: dual-role namespace: kafka labels: { strimzi.io/cluster: shop-kafka } spec: replicas: 3 roles: [controller, broker] storage: type: jbod volumes: - { id: 0, type: persistent-claim, size: 200Gi, class: fast-ssd, deleteClaim: false } resources: requests: { memory: 8Gi, cpu: "2" } limits: { memory: 8Gi, cpu: "4" } jvmOptions: { "-Xms": 4g, "-Xmx": 4g } --- apiVersion: kafka.strimzi.io/v1beta2 kind: Kafka metadata: name: shop-kafka namespace: kafka annotations: strimzi.io/node-pools: enabled strimzi.io/kraft: enabled spec: kafka: version: 4.0.0 metadataVersion: 4.0-IV3 listeners: - { name: internal, port: 9093, type: internal, tls: true, authentication: { type: scram-sha-512 } } - { name: external, port: 9094, type: loadbalancer, tls: true, authentication: { type: scram-sha-512 } } authorization: { type: simple } config: default.replication.factor: 3 min.insync.replicas: 2 offsets.topic.replication.factor: 3 transaction.state.log.replication.factor: 3 transaction.state.log.min.isr: 2 auto.create.topics.enable: false rack: { topologyKey: topology.kubernetes.io/zone } # spread replicas across availability zones entityOperator: topicOperator: {} userOperator: {}
Check versions: Strimzi supports specific Kafka versions per release. Use the Kafka and metadataVersion values listed in your Strimzi release documentation.

Topics and Users as Code

yaml apiVersion: kafka.strimzi.io/v1beta2 kind: KafkaTopic metadata: name: shop.orders.created.v1 namespace: kafka labels: { strimzi.io/cluster: shop-kafka } spec: partitions: 6 replicas: 3 config: { retention.ms: 604800000, min.insync.replicas: 2 } --- apiVersion: kafka.strimzi.io/v1beta2 kind: KafkaUser metadata: name: orders-service namespace: kafka labels: { strimzi.io/cluster: shop-kafka } spec: authentication: { type: scram-sha-512 } authorization: type: simple acls: - { resource: { type: topic, name: shop.orders.created.v1 }, operations: [Write, Describe] }

The User Operator creates a Kubernetes Secret with the generated password, which the application pod mounts. Topics, users and ACLs now live in Git and go through review like code.

Kubernetes Design Considerations

TopicGuidance
StorageFast, persistent volumes per broker (SSD). Prefer local or high-IOPS network disks, avoid slow shared file systems. Do not let broker data live on ephemeral storage
ResourcesMemory requests equal limits for brokers. Page cache is outside the JVM heap, so leave memory for it. Avoid CPU throttling
AvailabilityPod anti-affinity and rack awareness, so replicas land on different nodes and zones. Use a PodDisruptionBudget (Strimzi sets it)
NetworkingBrokers need individually addressable endpoints. Use Strimzi listener types: loadbalancer, nodeport, ingress, route. A single shared load balancer in front of all brokers does not work without per-broker advertising
UpgradesChange spec.kafka.version, the operator does a rolling restart one broker at a time and waits for replicas to catch up
Dedicated nodesUse taints and tolerations to give Kafka its own node pool, so noisy neighbours do not hurt latency

Managed Services

ServiceNotes
Confluent CloudFully managed, serverless-style clusters (Basic, Standard, Enterprise, Dedicated), managed connectors, Schema Registry, Flink and governance features. Pay for throughput, storage and features
Amazon MSK (Provisioned and Serverless)Managed brokers inside your VPC with IAM, SASL or TLS auth, MSK Connect, monitoring in CloudWatch. You still choose broker types and storage
Azure Event Hubs (Kafka endpoint)Kafka protocol compatibility for many clients. Verify support for the features you need
Aiven, Redpanda Cloud, othersManaged offerings on several clouds, each with own pricing and features

Cloud Connection Checklist

  • Private connectivity (VPC peering, PrivateLink, private endpoints) instead of public internet
  • Authentication supported by the service (API keys, SASL/SCRAM, IAM). Rotate credentials
  • Clients in the same region and zone as brokers when possible (latency and cross-zone data cost)
  • Quotas and limits: partitions per cluster, connections, throughput units
  • Monitoring: provider metrics APIs plus client-side metrics (lag, errors)
  • Exit plan: keep applications on standard Kafka APIs to avoid lock-in

Sizing a Cluster (Rule-of-Thumb Method)

  1. Throughput: peak MB/s in and out. Example: 50 MB/s in, 3 consumer groups reading, replication factor 3
  2. Network per broker includes replication: ingress = 50 MB/s x 3 (replicas) shared over brokers, egress = 50 MB/s x (consumers + 2 follower fetches). With 6 brokers each sees about 25 MB/s ingress and about 125 MB/s egress, which must stay well below NIC and disk limits (plan for 50 to 60 percent peak utilisation)
  3. Storage: daily data x retention days x replication factor, plus 30 percent headroom. Example: 2 TB/day x 7 days x 3 = 42 TB, plus headroom about 55 TB total
  4. Partitions: target throughput / per-partition throughput (measure it, often 10 to 30 MB/s per partition on producers) and the maximum number of parallel consumers you want. Keep partition counts per broker moderate (a few thousand)
  5. Memory: 6 to 8 GB heap is enough for most brokers, the rest goes to page cache
  6. Test: validate with kafka-producer-perf-test.sh and your own message sizes before launch
Tiered storage: If your Kafka version and platform support tiered storage, old segments move to object storage, so broker disks only hold recent hot data. This changes the storage line of the sizing calculation and speeds up cluster scaling.

Conclusion

Run Kafka yourself on VMs or on Kubernetes with the Strimzi operator (clusters, topics and users as YAML), or use managed services such as Confluent Cloud and Amazon MSK. Design storage, networking and availability zones carefully, size from throughput, retention and replication, and keep clients on standard Kafka APIs.

Quick Summary: Strimzi CRDs; PVC SSD + anti-affinity; managed = less ops; size by throughput x RF, storage x retention.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators