P4Kube: In-Network Load Balancer for Kubernetes
Garegin Grigoryan, Kevin Penkowski, Minseok Kwon
TL;DR
P4Kube addresses the latency and operational overhead of exposing Kubernetes pods to external clients via LoadBalancer and NodePort by moving load balancing into a P4-programmable router data plane, decoupling it from the Kubernetes control plane. It combines a Kubernetes integration plugin with a P4 data plane that uses ECMP hashing to distribute external traffic to replica pods, updating its state through control packets from the cluster. The approach yields up to about 50% reduction in average request time for short flows and maintains competitive performance for longer flows, while eliminating the need for external load balancers. This work demonstrates a practical path to simplify cluster operations and reduce data-path latency by leveraging in-network programmability and dynamic DP state updates.
Abstract
Kubernetes Services such as LoadBalancer and NodePort expose applications running on pods within a Kubernetes cluster to external users. While the LoadBalancer Service requires an external load-balancing middleware, its alternative, NodePort Service, adds additional hops on the path between clients and the worker nodes. In this paper, we propose P4Kube, a framework consisting of a P4 data plane program and a Kubernetes plugin. Our solution effectively performs load balancing of requests to the worker nodes of a cluster based on the number of running replicas. In P4Kube, the data packets completely bypass the system's control plane. Unlike the previous work, to update its state, the P4Kube data plane works directly with the Kubernetes control plane without any involvement of the network control plane. Our experiments show up to 50% improvement in the average request time to the cluster compared to conventional approaches.
