In this post, I will show how you can build a proxy-less load balancing for your gRPC services using the new xDS load balancing.

You can find the complete code for this experiment in


An example repository for demonstrating xDS load-balancer for Go gRPC client in a kubernetes cluster. If you are…

Why is load balancing in gRPC difficult?

If you are building gRPC based applications, you may already be aware of the usage of HTTP2 in gRPC. If you are unfamiliar with that, please read below

At a high-level, I want you to understand two points.

  1. gRPC is built on HTTP/2, and HTTP/2 is designed to have a single long-lived TCP connection.
  2. To do gRPC load balancing, we need to shift from connection balancing to request balancing.

What are the options?

There used to be two options to load balance gRPC requests in a Kubernetes cluster

  • Headless service
  • Using a Proxy (example Envoy, Istio, Linkerd)

Recently gRPC announced the support for xDS based load balancing, and as of this time, the gRPC team added support in C-core, Java, and Go languages. This is an essential feature as this will open a third option for load balancing in gRPC, and I will show how to do that in a Kubernetes cluster. gRPC will be moving from its original_ grpclb protocol_ to the new xDS protocol.


xDS API is a suite of APIs becoming popular and evolving into a standard used to configure various data plane software.

In the xDS API flow, the client uses the following main APIs:

  • Listener Discovery Service (LDS): Returns Listener resources. Used basically as a convenient root for the gRPC client’s configuration. Points to the RouteConfiguration.
  • Route Discovery Service (RDS): Returns RouteConfiguration resources. Provides data used to populate the gRPC service config. Points to the Cluster.
  • Cluster Discovery Service (CDS): Returns Cluster resources. Configures things like load balancing policy and load reporting. Points to the ClusterLoadAssignment.
  • Endpoint Discovery Service (EDS): Returns ClusterLoadAssignment resources. Configures the set of endpoints (backend servers) to load balance across and may tell the client to drop requests.

#grpc #xd #kubernetes #proxyless #load-balancing

Proxyless gRPC load balancing in Kubernetes
10.70 GEEK