This lab is currently in Beta, content may be updated as we refine the material
LABINTERMEDIATE

Traffic Management: Discovery Chain & Load Balancing

Drive Consul's discovery chain end to end on a single-VM Docker Compose mesh: define v1/v2 subsets with a service-resolver, split traffic 90/10 with a service-splitter, pin a path to v2 with a service-router, and apply a sticky-session load-balancing policy.

50 minutes
hashicorp/consul
Traffic Management: Discovery Chain & Load Balancing - Platform Engineering Hands-On Lab Icon
Share this Lab

Lab Overview

This is the hands-on lab for Section 8 (Gateways & Traffic Management) of the Consul 101 course. A single Ubuntu VM runs a small Docker Compose service mesh: a Consul server, a `backend` service running two versions (v1 and v2, each with its own Envoy sidecar), and a mesh client whose sidecar dials `backend` as an upstream. Every request you send flows through the real discovery chain, so the config entries you write have concrete, observable effects.

You will:

  • Set the backend protocol to HTTP and author a `service-resolver` that defines

`v1` and `v2` subsets by filtering on instance metadata

  • Write a `service-splitter` that sends 90% of traffic to `v1` and 10% to `v2`,

then prove the split empirically by counting responses across 200 requests

  • Add a `service-router` that pins a specific path prefix to the `v2` subset

regardless of the splitter, for a canary preview URL

  • Apply a hash-based load-balancing policy (`maglev` with a header hash) on the

resolver for sticky sessions, and confirm it compiles into the discovery chain

  • Configure subset failover on the resolver and watch traffic shift to the

healthy version when the primary is stopped

By the end you will have used all three discovery-chain config entries and a load-balancing policy to control real mesh traffic, the exact toolkit behind canary rollouts, blue-green deploys, and session affinity.

What You'll Learn

Author a service-resolver that defines subsets by filtering on instance metadata

Split traffic across subsets by weight with a service-splitter and verify the split empirically

Route requests to a specific subset by path prefix with a service-router

Apply a hash-based load-balancing policy on the resolver for sticky sessions

Configure subset failover on the resolver and observe traffic shifting to a healthy version

Prerequisites

Completion of the Consul 101 Section 8 lessons (discovery chain and load-balancing policies)

Basic Docker and Docker Compose familiarity

Comfort reading HCL and running the consul CLI

Technologies Covered

consulservice-meshdiscovery-chainservice-resolverservice-splitterservice-routerload-balancingcanarytraffic-management

Choose your plan

Simple, Transparent Pricing

Unlock full access to TeKanAid courses, labs, and bootcamps

Buying for a team? Private corporate training is available for up to 15 learners.View team training
MonthlyQuarterly
Try Premium free for 7 days →

Just exploring? Start free below. Want the full experience? Try Premium free for 7 days (card required, $0 today).

Pro

All courses, with lab scripts to run on your own machine

$59/month

Renews automatically. Cancel anytime.

Final price verified at checkout.

  • Full access to all courses
  • Lab scripts to download and run on your own machine (hosted labs not included)
  • Progress tracking
  • Certificate of completion
  • Community access
  • Self-paced bootcamps
  • Premium puzzle library not included (5 free puzzles available)
  • New content access
Recommended

Premium

Full access, including unlimited hosted labs

$99/month

Renews automatically. Cancel anytime.

Final price verified at checkout.

  • Everything in Pro
  • Unlimited hands-on labs, fully hosted on TeKanAid Academy (nothing to set up)
  • Full access to the puzzle library
  • Lab AI Assistant
  • Priority support

Prefer a single course?

Purchase individual courses for a one-time fee of $79. Full access to course content, quizzes, certificates, and community features, lab access is not included.

Browse Courses

Just exploring? Start free, no account needed

Three free ways to start. All bridge into the paid Premium catalog when you're ready.

Not ready to commit? The crash course is email-only. No academy account required.

Ready to Get Started?

Start this hands-on lab and build real-world Platform Engineering skills

Get Access Now