GrabFabrice HarbulotProblem & solution
Kafka on Kubernetes: Reloaded for fault tolerance
Summary
Grab's real-time data streaming platform, Coban, operates Kafka on AWS Elastic Kubernetes Service using Strimzi, allocating an entire EC2 worker node with NVMe instance store volumes to each broker. An initial architecture suffered from client connection errors, broken Network Load Balancer target groups, and zombie Persistent Volume Claims when worker nodes terminated. To achieve automated fault tolerance, the team integrated the AWS Node Termination Handler in Queue Processor mode with Auto Scaling lifecycle hooks, ensuring Kafka receives a SIGTERM to migrate partition leadership gracefully before shutdown. They also introduced the Kubernetes Cluster Autoscaler to dynamically provision replacement nodes during maintenance events and used the AWS Load Balancer Controller with TargetGroupBinding custom resources to dynamically update load balancer targets using IP mode.
Context
Unexpected EC2 worker node terminations in a Kafka on Kubernetes setup caused client errors, stale Network Load Balancer target groups, and pod startup failures due to statically bound Persistent Volume Claims on deleted NVMe instance stores, requiring manual intervention.
Approach / What changed
Deploy the AWS Node Termination Handler using SQS to drain nodes and trigger graceful Kafka leadership migration, pair Auto Scaling Groups with Kubernetes Cluster Autoscaler for node replacement, and use the AWS Load Balancer Controller with TargetGroupBinding CRDs for dynamic IP-based target group registration.
Takeaways
Setting Strimzi's terminationGracePeriodSeconds to 180 seconds provides sufficient time for Kafka to gracefully migrate partition leadership across surviving brokers upon receiving a SIGTERM.
The AWS Node Termination Handler in Queue Processor mode consumes lifecycle and maintenance events from SQS to pause instance termination while cordoning and draining worker nodes.
Using the AWS Load Balancer Controller with TargetGroupBinding custom resources switches NLB target groups to IP mode, automatically synchronising pod endpoints without manual reconfiguration.
Source and freshness
- Source
- engineering.grab.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.