Difficulty: Beginner
Estimated Time: 10 minutes

Load balancing in Consul service mesh with Envoy

In this hands-on lab, you will operate a Consul datacenter deployed using Docker and configure load balancing policies on service sidecar proxies.

Specifically, you will:

  • Inspect the environment with the Consul CLI
  • Verify default least_request load balancing policy
  • Use centralized configuration to set service defaults
  • Use the maglev policy to configure load balancing with sticky session
  • Verify the new configuration
  • Use least_request load balancing policy
  • Verify the new configuration
  • Use the ingress gateway to access the service

The environment provides you with a Consul service mesh with one server agent node, three client agent nodes to run the services, and one ingress gateway node to allow external requests inside your service mesh.

To learn how to deploy a Consul service mesh using Envoy as data plane, review the Secure Service Communication with Consul Service Mesh and Envoy tutorial.

To learn more on ingress gateways, review the Allow External Traffic Inside Your Service Mesh With Ingress Gateways tutorial.

Review

In this hands-on lab, you operated a Consul datacenter that was deployed using Docker and configured load balancing policies on the service sidecar proxies.

Specifically, you:

  • Inspected the environment with the Consul CLI
  • Verified the default round_robin load balancing policy
  • Used centralized configuration to set service defaults
  • Used the maglev policy to configure load balancing with sticky session
  • Verified the new configuration
  • Used the least_request load balancing policy
  • Verified the new configuration
  • Used the ingress gateway to access the service

The environment for this lab was provided with a Consul service mesh with one server agent node, three client agent nodes to run the services, and one ingress gateway node to allow external requests inside your service mesh.

To learn how to deploy a Consul service mesh using Envoy as data plane, review the Secure Service Communication with Consul Service Mesh and Envoy tutorial.

To learn more on ingress gateways, review the Allow External Traffic Inside Your Service Mesh With Ingress Gateways tutorial.

Load balancing in Consul service mesh with Envoy

Step 1 of 5

Lab Infrastructure Provisioning

There are a few components that need to be added to the environment; we are adding them now. Wait for the complete message and then move to the next step.

Example Output

 - Install prerequisites
 - Pulling Docker Image
 - Creating Docker volumes
 - Copying configuration files
 - Starting Consul Server
 ...
 - Starting Consul Clients
 ...
 - Starting Ingress Gateway
 ...
 ...
 - Starting Applications and configuring service mesh
 - Complete! Move on to the next step.

and concluding with

- Complete! Move on to the next step.

Once this message appears, you are ready to continue.

Architecture for the lab

Consul service mesh load balancing with client service

Configuration files

While you wait for the environment to complete deploy you can review the files you are going to use for this lab later:

File Description
server.hcl Server agent configuration file
agent.hcl Client agent configuration file
default.hcl Service defaults configuration
hash-resolver.hcl Maglev load balancing policy definition
igw-backend.hcl Ingress Gateway central configuration
least-req-resolver.hcl Least request load balancing policy definition
svc-client.hcl Service configuration file for client
svc-clone.hcl Service configuration file for backend-clone
svc-main.hcl Service configuration file for backend-main
Terminal
server
client
Consul UI
Ingress GW
Dashboard