Professional Documents
Culture Documents
Container Networking - From Docker To Kubernetes
Container Networking - From Docker To Kubernetes
m
pl
im
en
Container
ts
of
Networking
From Docker to Kubernetes
Michael Hausenblas
The NGINX Application Platform
powers Load Balancers,
Microservices & API Gateways
https://www.nginx.com/solutions/microservices/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/ https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/web-mobile-acceleration/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/ https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/web-mobile-acceleration/
https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/
https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/adc/
https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/web-mobile-acceleration/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/application-security/
https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/web-mobile-acceleration/
https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/ https://www.nginx.com/solutions/web-mobile-acceleration/ https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/
https://www.nginx.com/solutions/web-mobile-acceleration/ https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/adc/
https://www.nginx.com/solutions/adc/
https://www.nginx.com/solutions/microservices/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/
https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/application-security/ https://www.nginx.com/solutions/web-mobile-acceleration/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/microservices/
https://www.nginx.com/solutions/adc/ https://www.nginx.com/solutions/cloud/ https://www.nginx.com/solutions/api-gateway/
https://www.nginx.com/products/ https://www.nginx.com/
FREE TRIAL
https://www.nginx.com/products/ LEARN MORE
https://www.nginx.com/
https://www.nginx.com/products/ https://www.nginx.com/
https://www.nginx.com/
Learn more at nginx.com
https://www.nginx.com/
https://www.nginx.com/ https://www.nginx.com/
Container Networking
From Docker to Kubernetes
Michael Hausenblas
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Container Networking, the cover
image, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsi‐
bility for errors or omissions, including without limitation responsibility for damages resulting from
the use of or reliance on this work. Use of the information and instructions contained in this work is
at your own risk. If any code samples or other technology this work contains or describes is subject
to open source licenses or the intellectual property rights of others, it is your responsibility to ensure
that your use thereof complies with such licenses and/or rights.
This work is part of a collaboration between O’Reilly and NGINX. See our statement of editorial
independence.
978-1-492-03681-4
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Motivation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Introducing Pets Versus Cattle 1
Go Cattle! 2
The Container Networking Stack 3
Do I Need to Go “All In”? 4
3. Multi-Host Networking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Multi-Host Container Networking 101 13
Options for Multi-Host Container Networking 13
Docker Networking 15
Administrative Considerations 16
Wrapping It Up 16
4. Orchestration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
What Does a Scheduler Actually Do? 19
Docker 20
Apache Mesos 21
Hashicorp Nomad 23
Community Matters 25
Wrapping It Up 25
v
5. Service Discovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
The Challenge 27
Technologies 28
Load Balancing 32
Wrapping It Up 34
7. Kubernetes Networking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
A Gentle Kubernetes Introduction 43
Kubernetes Networking Overview 45
Intra-Pod Networking 46
Inter-Pod Networking 47
Service Discovery in Kubernetes 50
Ingress and Egress 53
Advanced Kubernetes Networking Topics 55
Wrapping It Up 57
A. References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
vi | Table of Contents