I’m using service dns:port (grpc-test-load-balancer:18788) in my grpc client to connect to grpc server pods, but can’t seem to figure out what I’m doing wrong. Load balancer algorithm is always random. Can you help?
You will also need to deploy a sidecar alongside your gRPC client application, configure the client application to connect to a local port exposed by the proxy which routes traffic across the service mesh to the upstream gRPC server.
Here’s an example client and server deployment config which may help to better explain how the communication should be configured.
They dont seem to change my load balance algorithm. Can you show me the correct path for this, can’t find the right policies for grpc, read several articles on consul yet I’m stuck.
Should I also recreate my client/server or anything after i deploy my service resolver?
In order to enable service resolution and apply load balancer policies, you first need to configure HTTP as the service protocol in the service's service-defaults configuration entry.
So for grpc we first create a service defaults yaml like this
And for service resolving to happen, we need to select an appropriate header for grpc, which one can inspect on wireshark/http2 protocol. So our service resolver should look like this
Last Update: apparently this resolves all traffic to the same hash because content-type is same for all grpc messages.
I think SourceIP is bugged because docs state:
SourceIP (bool: false) - Determines whether the hash should be of the source IP address
rather than of a field and field value. Cannot be specified along with Field or FieldValue.
But if i try to add it to hash policies without field, i get this error
admission webhook "mutate-serviceresolver.consul.hashicorp.com" denied the request:
serviceresolver.consul.hashicorp.com "grpc-test" is invalid:
spec.loadBalancer.hashPolicies[1].field: Invalid value: "":
must be one of "header", "cookie", "query_parameter"
And i think there is no way of load balancing grpc without using ip address. @blake