6 minute read

Running Kafka and Flink on Kubernetes can be a good infrastructure boundary, but the operator is not the availability design. Strimzi manages Kafka resources; the Flink Kubernetes Operator manages Flink deployments. EKS supplies scheduling, networking, identity, and persistent volumes. Availability and recovery still depend on broker placement, topic replication, durable checkpoints, secrets, and a carefully rehearsed upgrade sequence.

Kafka and Flink on EKS architecture

Establish the operational topology

A production topology should separate:

  • EKS worker groups for Kafka brokers and Flink task managers;
  • dedicated storage classes and persistent volumes;
  • cluster and namespace RBAC;
  • ingress or bootstrap exposure;
  • observability and checkpoint retention from the application namespace.

Keep ZooKeeper-based and KRaft-based migration decisions aligned with supported Strimzi and Kafka versions. A platform that mixes upgrade plans for EKS, Strimzi, Kafka, Flink, and operator CRDs creates avoidable failure modes. Pin each layer and maintain a compatibility matrix in source control.

The Kafka brokers, Flink operators, and workloads should use distinct node groups. This is primarily for failure and resource isolation, not because an operator requires it. Use topology spread constraints, PodDisruptionBudgets, and AntiAffinity so all brokers are not scheduled in one zone or on one host.

Install Kafka with Strimzi

The following Kafka custom resource demonstrates the main production controls:

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
  name: events
  namespace: data-platform
spec:
  kafka:
    version: 3.3.2
    replicas: 3
    listeners:
      - name: plain
        port: 9092
        type: internal
        tls: false
      - name: tls
        port: 9093
        type: internal
        tls: true
        authentication:
          type: tls
    config:
      offsets.topic.replication.factor: 3
      transaction.state.log.replication.factor: 3
      transaction.state.log.min.isr: 2
      default.replication.factor: 3
      min.insync.replicas: 2
      num.partitions: 12
      auto.create.topics.enable: false
    storage:
      type: jbod
      volumes:
        - id: 0
          type: persistent-claim
          size: 500Gi
          class: gp3-data
          deleteClaim: false
    template:
      pod:
        affinity:
          podAntiAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              - labelSelector:
                  matchLabels:
                    strimzi.io/name: events-kafka
                topologyKey: topology.kubernetes.io/zone
        securityContext:
          runAsNonRoot: true
        terminationGracePeriodSeconds: 300
  zookeeper:
    replicas: 3
    storage:
      type: persistent-claim
      size: 20Gi
      class: gp3-data
      deleteClaim: false
  entityOperator:
    topicOperator: {}
    userOperator: {}

Remove plain once all internal clients use TLS. For a production TLS topology, do not accept unauthenticated traffic merely because the listener is internal. Strimzi can generate and rotate broker and user certificates, but the owning team must still monitor expiration and maintain a tested recovery path for CA renewal.

Create topics declaratively:

apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
  name: orders-v1
  namespace: data-platform
  labels:
    strimzi.io/cluster: events
spec:
  partitions: 24
  replicas: 3
  config:
    min.insync.replicas: "2"
    retention.ms: "1209600000"
    cleanup.policy: delete

The partition count should be based on consumer parallelism and peak per-partition throughput. Doubling partitions is easy; reducing them without a migration is not. Aim for 30 to 50 percent throughput headroom and retain source data for longer than the maximum restore and validation window.

The Flink Kubernetes Operator manages Flink’s Kubernetes resources, but checkpoints and savepoints must be written to durable storage. A Flink state backend is not a substitute for an application restore procedure.

Use an IRSA-backed service account for S3 access instead of placing cloud credentials in application environment variables. Checkpoints can be on S3, but local state and task-manager disk still matter to performance. Tune checkpoint interval so state upload completes with at least 30 percent headroom before the next checkpoint.

A Flink deployment can be expressed as:

apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: orders-enricher
  namespace: data-platform
spec:
  image: 111122223333.dkr.ecr.us-east-1.amazonaws.com/flink/orders:v1.8.0
  flinkVersion: v1_16
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "4"
    state.backend: rocksdb
    state.checkpoints.dir: s3://example-flink/checkpoints/orders-enricher
    state.savepoints.dir: s3://example-flink/savepoints/orders-enricher
    execution.checkpointing.interval: 30 s
    execution.checkpointing.min-pause: 10 s
    execution.checkpointing.mode: EXACTLY_ONCE
    execution.checkpointing.timeout: 120 s
    high-availability: org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory
    high-availability.storageDir: s3://example-flink/ha/orders-enricher
  serviceAccount: flink-orders
  job:
    jarURI: local:///opt/flink/usrlib/orders-enricher.jar
    parallelism: 12
    upgradeMode: savepoint
    state: running
  jobManager:
    resource:
      memory: "2048m"
      cpu: 1
  taskManager:
    replicas: 3
    resource:
      memory: "4096m"
      cpu: 2

The resource names and supported Flink operator fields vary by operator version. Apply the manifest to a non-production namespace with the exact operator CRD before promoting it.

Configure Kafka Connect as a separate workload

Strimzi KafkaConnect is appropriate for connector plugins, but connectors are not Kafka brokers and Flink jobs. Give Connect its own workers and offset, config, and status topics with replication factor three:

apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaConnect
metadata:
  name: data-connect
  namespace: data-platform
  annotations:
    strimzi.io/use-connector-resources: "true"
spec:
  version: 3.3.2
  replicas: 3
  bootstrapServers: events-kafka-bootstrap:9093
  tls:
    trustedCertificates:
      - secretName: events-cluster-ca-cert
        certificate: ca.crt
  config:
    group.id: data-connect
    offset.storage.topic: connect-offsets
    config.storage.topic: connect-configs
    status.storage.topic: connect-status
    key.converter: org.apache.kafka.connect.json.JsonConverter
    value.converter: org.apache.kafka.connect.json.JsonConverter

Build a custom Connect image containing exactly the connector plugins required. Scan it and track plugin versions. A connector installed interactively in a running pod disappears on restart and is impossible to audit.

Storage and networking guardrails

Use a Retain reclaim policy and WaitForFirstConsumer binding for data volumes. Validate per-volume IOPS and throughput with a broker-size workload. A low-latency NVMe local volume can improve performance, but it changes the recovery contract: a node loss loses that copy and the broker must replicate from peers. Keep the working set and replication traffic measurable.

Network policies should allow only broker, operator, Prometheus, and client paths required. Internal DNS names belong to the platform contract, while client applications should consume a documented bootstrap service. TLS secrets should come from Kubernetes secret stores or certificate tooling; application manifests should refer to secret names, never certificate private keys.

Scale to lag and state constraints

Autoscaling Kafka is not solved by adding pods. Broker count changes replica placement and operational work, while topic partitions set concurrency. Scale consumers and Flink parallelism first when source lag grows but brokers are healthy.

For Flink:

  • scale after max consumer lag rises for at least two checkpoint intervals;
  • require successful checkpoints with p95 duration below 50 percent of the interval;
  • keep task manager managed memory below the JVM pressure threshold;
  • increase topic partitions before increasing operator parallelism beyond the maximum keyed partition count;
  • stop scaling when backpressure moves from the source to an external sink.

The operator may recreate task managers, but operator resizing alone does not make state redistribution free. A savepoint-based rescale preserves the logical state and changes parallelism at a controlled boundary.

Observe the complete chain

Collect:

  • Kafka under-replicated partitions, offline partitions, active controllers, request latency, log bytes, and disk utilization;
  • Flink checkpoint age, checkpoint duration, failed checkpoints, backpressure, restart count, processed records, and end-to-end event age;
  • Connect task state and connector errors;
  • EKS node pressure, volume attach failures, zone capacity, and certificate expiration.

Set SLOs at the consumer boundary. One useful target is: 99 percent of events are emitted within 60 seconds, with zero offline partitions and checkpoint age below two minutes. Alert on error budget burn, not only static raw metrics.

Upgrade and restore checklist

Do not combine EKS, operator, Kafka, and Flink major upgrades in one change. A controlled Flink upgrade is:

kubectl get flinkdeployment orders-enricher -n data-platform -o yaml
kubectl logs -n data-platform deployment/flink-kubernetes-operator
kubectl get flinkdeployment orders-enricher -n data-platform \
  -o jsonpath='{.status.jobStatus.savepointInfo.location}'
  1. Verify Kafka ISR and replication; require zero under-replicated partitions.
  2. Verify the latest Flink savepoint is complete in S3 and record its location.
  3. Stop or suspend downstream writers if the upgrade changes external-sink semantics.
  4. Upgrade the operator in a staging cluster and validate the CRD conversion.
  5. Roll the deployment with a versioned image and savepoint upgrade mode.
  6. Confirm restored parallelism, restored records, checkpoint success, and stable lag.
  7. If the new job fails, stop it, point the restore location to the recorded savepoint, and redeploy the previous image.

Kafka rolling upgrades belong to one change set per broker-visible version. Before each node step, require all replicas in sync and wait for partition leaders and ISR to recover. Never force a storage replacement merely because a pod is Pending.

A disaster-recovery restore has additional inputs:

  • recover or connect the destination EKS cluster;
  • provision namespaces, RBAC, service accounts, storage classes, and operators at pinned versions;
  • restore Strimzi secrets only through an approved secret backup process;
  • restore Kafka configuration and topic definitions;
  • restore data by replication or broker-volume recovery according to the RPO;
  • restore Flink from a durable savepoint, then validate source offset and sink deduplication.

Do not claim a 15-minute RTO until a rehearsal has measured provisioning, volume attachment, broker health, and job restore. Track broker RTO, Flink restore RTO, source lag catch-up, and replay duplicates per drill.

The system is operational when a new engineer can execute this checklist without guessing which object, secret, volume, checkpoint, or source offset is authoritative.