Cluster Peering: Connecting Two Datacenters
Stand up two independent Consul datacenters, peer them with the generate-token and establish handshake, export a service across the link, and call it end to end through the mesh gateways.
Lab Overview
Cluster peering is the modern way to connect two independent Consul datacenters so a service in one can securely reach a service in the other, without merging the clusters into a single failure domain.
In this lab you work with two complete datacenters (dc1 and dc2), each a two-server Consul cluster with its own mesh gateway (six VMs in total). You will:
- Confirm both datacenters are healthy and fully independent
- Peer them with the two-step `generate-token` / `establish` handshake
- Export a service from dc1 to dc2 with the `exported-services` config entry and
watch it appear as an imported service on the far side
- Authorize the connection with a peer-aware service intention and call the
exported service end to end through both mesh gateways
Everything runs on Consul Community Edition, so there is no shared Raft, no shared gossip pool, and no primary datacenter, exactly the loosely coupled model that makes cluster peering the recommended choice today.
What You'll Learn
Explain why two independent datacenters are preferred over one stretched cluster
Establish a peering connection using the generate-token and establish handshake
Export a service across a peering with the exported-services config entry
Authorize and call a peered service end to end through mesh gateways
Prerequisites
consul-fundamentals
service-mesh-basics
linux-command-line
Technologies Covered
Choose your plan
Simple, Transparent Pricing
Unlock full access to TeKanAid courses, labs, and bootcamps
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
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
Premium
Full access, including unlimited hosted labs
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 CoursesJust 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