Kubernetes - Consul - Envoy - How to set up load balancing algorithm?

2/22/2021

I'm trying to setup sticky grpc communications using consul/envoy. Somehow load balance algorithm stays random, cannot apply it to my service.

Official consul documentation got me this far. What am I doing wrong?

apiVersion: 'v1'
kind: 'Service'
metadata:
  name: grpc-test-load-balancer
  labels:
    app: grpc-loadbalancer
spec:
  ports:
    - protocol: 'TCP'
      port: 18788
      targetPort: 18788
  selector:
    app: 'grpc-test'
  type: 'LoadBalancer'
  loadBalancerIP: ''
---
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceResolver
metadata:
  name: grpc-test-load-balancer
spec:
  loadBalancer:
    policy: maglev
    hashPolicies:
      - field: "cookie"
        fieldValue : "brown-cookie"
-- Can Uysal
consul
envoyproxy
kubernetes

0 Answers