In this video, we'll explore overlay networks in Docker Swarm: how containers on different hosts communicate as if they were on the same machine. Using a simple island analogy, I'll explain the purpose of overlay networks, how communication between nodes works, automatic DNS services, built-in load balancing, routing mesh, and VXLAN traffic over UDP port 4789.
In practice, we'll create frontend and backend overlay networks, build images for the API and Nginx, deploy services using docker service create, connect them to different networks, and test communication using docker exec, ping, docker network inspect, and docker service inspect. We'll also discuss IPSec encryption, when it's worth enabling, and how it impacts performance. This video is based on a downloaded scenario.
00:00 Introduction: Overlay Networks in Docker Swarm
00:18 What is an Overlay Network
00:30 Island Analogy: Hosts, Containers, and Swarm Tunnels
03:13 Why Overlay Networks Are Needed
04:14 Overlay vs. Regular Networking: DNS, Routes, and Load Balancing
04:49 How VXLAN Traffic Flows and Why UDP Port 4789 Is Needed
05:23 Load Balancing Between Service Replicas
05:54 IPSec Encryption of Traffic Between Hosts
06:46 When IPSec Is Needed, and When It's Best Not to Enable It
08:31 Hands-on: Cluster Nodes, Ingress, and Docker_gwbridge
09:32 Creating Frontend_net and Backend_net Overlay Networks
10:16 Preparing Docker Images for API and Web
11:29 Starting an API Service with Two Replicas
12:46 Starting a Web Service in two overlay networks
14:50 Checking the application and ingress mesh operation
17:03 Checking communication between containers via ping api
19:20 Checking subnets and interfaces within containers
21:50 Final diagram of frontend_net and backend_net
22:55 Conclusion: How overlays combine and isolate services