Top Banner
Docker Networking Workshop Jana Radhakrishnan Nicola Kabar
40

Docker Networking : 0 to 60mph slides

Jan 23, 2017

Download

Technology

Docker, Inc.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker Networking : 0 to 60mph slides

Docker Networking WorkshopJana Radhakrishnan

Nicola Kabar

Page 2: Docker Networking : 0 to 60mph slides

Docker Networking Model

ArchitectureDesign ConsiderationsAdvantages

Agenda

Evolution + Under the Hood

DriversDNSRoutingLoad BalancingDemos

Deployment Models Exercises

+

Roadmap

Page 3: Docker Networking : 0 to 60mph slides

Container Networking ModelDesign, Architecture, and Key Advantages

Page 4: Docker Networking : 0 to 60mph slides

• Traditional Networking is incredibly vast and complex

• But, Networking is inherent part of distributed applications

• Make it developer-friendly & application driven.

Why is Networking important?

Page 5: Docker Networking : 0 to 60mph slides

“We'll do for Networking, What Docker did for

Compute.” — Moby

Page 6: Docker Networking : 0 to 60mph slides

• Make "network" a first class object

• Distributed application portability

• Secure control and data paths

• Provide a pluggable networking stack

• Span networks across multiple hosts

• Support multiple OS platforms

Goals

Page 7: Docker Networking : 0 to 60mph slides

Design Philosophy

• Users First: • Application Developers • IT/Network Ops

• Plugin API Design • Batteries Included but Swappable

Page 8: Docker Networking : 0 to 60mph slides

Container Networking Model

• Endpoint

• Network

• Sandbox

Page 9: Docker Networking : 0 to 60mph slides

Create

Network

Create

Container

Defer to Driver

Defer to Driver

Page 10: Docker Networking : 0 to 60mph slides

Library for creating and managing network stacks for containers

Driver-based networking

Implements the Container Network Model

Native service discovery and load balancing

What’s libnetwork?

Page 11: Docker Networking : 0 to 60mph slides

• Pluggability Flexibility• Docker Native UX and API User Friendly• Distributed Scalability + Performance • Decentralized Highly-Available• Out-of-the-Box Support with Docker Datacenter

Key Advantages

Page 12: Docker Networking : 0 to 60mph slides

Use-Case: Microservices Segmentation

Page 13: Docker Networking : 0 to 60mph slides

Q&A

Page 14: Docker Networking : 0 to 60mph slides

Break

Page 15: Docker Networking : 0 to 60mph slides

Docker Networking Evolution

Page 16: Docker Networking : 0 to 60mph slides

Docker Networking Timeline

1.7 1.8 1.9 1.10 1.11

Libnetwork(CNM) - Multihost Networking- Plugins- IPAM- Network UX/API

Service Discovery Distributed DNS

- Aliases- DNS Round Robin LB

1.12

Page 17: Docker Networking : 0 to 60mph slides

Under the Hood of Bridge

Networking

Page 18: Docker Networking : 0 to 60mph slides

Bridge Networking Under the Hood

• netns• Iptables• NAT• IP management• Routing• userland proxy eth0

docker0

C1

eth0 eth0

C2

• Iptables• NAT

• User proxy• Routing

eth0

Page 19: Docker Networking : 0 to 60mph slides

Demo 1 : Bridge Networking

Page 20: Docker Networking : 0 to 60mph slides

Under the Hood of Multihost

Networking

Page 21: Docker Networking : 0 to 60mph slides

KV Store

Docker Host Docker Host Docker Host

C1

C2

C3C4

C5

C6C7

C8

C9

Page 22: Docker Networking : 0 to 60mph slides

Overlay Networking Under the Hood

1. VXLAN==>DataTransport • Virtual eXtensible Local Area Networks • L2 Network over an L3 network ( overlay ) • RFC7348• Invisible to the container• Host as VXLAN Tunnel End Point (VTEP) • Point-to-Multi-Point Tunnels• Proxy-ARP

Page 23: Docker Networking : 0 to 60mph slides

Overlay Networking Under the Hood

2. Key-Value Store• Network ID• Subnets• Nodes• VXLAN ID

Page 24: Docker Networking : 0 to 60mph slides

Overlay Networking Under the Hood

3. Network Namespaces • A Linux Bridge per Subnet per Overlay Network per Host• A VXLAN interface per Overlay Network per Host• 1 Linux Bridge per Host for default traffic

(docker_gwbridge)• Lazy creation ( Only if container is attached to network)

Page 25: Docker Networking : 0 to 60mph slides

Overlay Networking Under the Hood

C1

C2

C3

C5

C4

br0

Veth

Veth

Veth

Host NIC

VXLAN

Host NIC

br0

Veth

Veth

VXLAN

Docker Host 1 Docker Host 2

Page 26: Docker Networking : 0 to 60mph slides

Demo 2 : Overlay Networking

Page 27: Docker Networking : 0 to 60mph slides

Under the Hood of embedded

DNS

Page 28: Docker Networking : 0 to 60mph slides

Embedded DNS Under the Hood

• DNS listener per container• Distributed ( for both bridge and overlay)• Proxy for external DNS services• Can be used with DNSSEC

engine

DNS Server

DNS Resolver DNS Resolver

DNS requests

Page 29: Docker Networking : 0 to 60mph slides

Demo 3 : DNS Demo

Page 30: Docker Networking : 0 to 60mph slides

Break

Page 31: Docker Networking : 0 to 60mph slides

Networking Exercises

Page 32: Docker Networking : 0 to 60mph slides

• 2 VMS per attendee• Ubuntu 15 based with Docker 1.12!• Received SSH pem/ppk and VM info• Go ahead and SSH Into one of the machines.

Lab Access

Page 33: Docker Networking : 0 to 60mph slides

Pre-Defined Networks

bridge (default) --> containers in local docker0 bridgenull --> containers without any network interfaceshost --> containers use same interfaces as host ( same netns)

Page 34: Docker Networking : 0 to 60mph slides

- Run `docker network ls` to list all the networks on the host- Run `docker network inspect <network_name>` to inspect a network- You can easily remove a network with `docker network rm

<network_name>` No need to remove any network… but you can try

Exercise 0: Explore Docker Networks

Page 35: Docker Networking : 0 to 60mph slides

- Start a container with `none` network and explore `ifconfig`- docker run -it --net=none mrjana/lab

- Try to ping www.docker.com - Are the results expected?- What are the key use-cases and disadvantages of using `none` networks?

Exercise 1: Pre-Defined Networks

Page 36: Docker Networking : 0 to 60mph slides

- Start a container with `host` network and explore `ifconfig`- docker run -it --net=host mrjana/lab

- Run a `tcpdump -i eth0 port 22` and explore the results?- Are the results expected?- What are the key use-cases and disadvantages of using `Host`

networking?

Exercise 2: Pre-Defined Networks

Page 37: Docker Networking : 0 to 60mph slides

- Create a custom bridge network and call it `mynet`- docker network create -d bridge mynet

- Start two containers with the mynet network and name them c1 and c2- docker run -itd --net=mynet –name c1 mrjana/lab- docker run -itd --net=mynet –name c2 mrjana/lab

- Run `ping c1` from c2 container. - Run a `nslookup c1` from c2 container and explore the results?

Exercise 3: User-Defined Networks

Page 38: Docker Networking : 0 to 60mph slides

- Start two containers with the `mynet` network and name them c3 with network-alias=foo and c4 with network-alias=bar.

- docker run -itd --net=mynet –name c3 –net-alias foo mrjana/lab- docker run -itd --net=mynet –name c4 –net-alias bar mrjana/lab

- Run `ping c3` from c4 container. - Run `ping foo` from c4 container. What do you observe?- Lets create another container c5 that is part of the foo network alias.- Run `ping foo` from c4 container. What do you observe?- Run a `nslookup foo` from c4 container and explore the results?

Exercise 4: Aliases and Loadbalancing

Page 39: Docker Networking : 0 to 60mph slides

- Create another network and name it `myothernet` - Start two more containers: container c6 on the `mynet` network and c7 on

the `myothernet` network. - docker run -itd --net=mynet –name c6 mrjana/lab- docker run -itd --net=myothernet –name c7 mrjana/lab

- Now let’s create another container `c8` on the `mynet` network. - docker run -itd --net=mynet –name c8 mrjana/lab

- Now, connect c8 to myothernet- docker network connect myothernet c8

- Try and ping c6 and c7 from c8.- Can you ping c7 from c6 ?

Exercise 5: Multi-Network Container Connection

Page 40: Docker Networking : 0 to 60mph slides

Thank you!