SlideShare a Scribd company logo
Kubernetes Networking
Seattle Kubernetes Meetup
CJ Cullen <cjcullen@google.com>
Software Engineer
@cj_cullen
github.com/cjcullen
Docker Networking
Docker networking
docker start ...
Docker networking
docker start ...
Docker networking
docker0 172.16.1.0/24
Docker networking
docker0 172.16.1.0/24
docker run ...
Docker networking
docker0 172.16.1.0/24
Docker networking
docker0 172.16.1.0/24
172.16.1.1
vethAQ2IT
eth0
Docker networking
docker0 172.16.1.0/24
172.16.1.1
vethAQ2IT
eth0
docker run ...
Docker networking
docker0 172.16.1.0/24
172.16.1.1
vethAQ2IT
eth0
172.16.1.2
vethS1LUI
eth0
172.16.1.1
172.16.1.2
Docker networking
172.16.1.1
172.16.1.1
172.16.1.1
172.16.1.2
Docker networking
172.16.1.1
172.16.1.1
NAT
NAT
NAT
NAT
NAT
Host ports
A: 172.16.1.1
3306
B: 172.16.1.2
80
9376
11878SNAT
SNAT
C: 172.16.1.1
8000
Host ports
A: 172.16.1.1
3306
B: 172.16.1.2
80
9376
11878SNAT
SNAT
C: 172.16.1.1
8000
REJECTED
Kubernetes Networking
Kubernetes networking
IPs are routable
• vs docker default private IP
Pods can reach each other without NAT
• even across nodes
No brokering of port numbers
• too complex, why bother?
This is a fundamental requirement
• can be L3 routed
• can be underlayed (cloud)
• can be overlayed (SDN)
10.1.1.0/24
10.1.1.1
10.1.1.2
Kubernetes networking
10.1.2.0/24
10.1.2.1
10.1.3.0/24
10.1.3.1
10.1.1.0/24
10.1.1.1
10.1.1.2
Kubernetes networking
10.1.2.0/24
10.1.2.1
10.1.3.0/24
10.1.3.1
?
Kubernetes networking
On GCE/GKE
• GCE Advanced Routes (program the fabric)
• “Everything to 10.1.1.0/24, send to this VM”
Plenty of other ways
• AWS: Route Tables
• Weave
• Calico
• Flannel
• OVS
• OpenContrail
• Cisco Contiv
• Others...
Kubernetes networking
On GCE/GKE
• GCE Advanced Routes (program the fabric)
• “Everything to 10.1.1.0/24, send to this VM”
Plenty of other ways
• AWS: Route Tables
• Weave
• Calico
• Flannel
• OVS
• OpenContrail
• Cisco Contiv
• Others...
Kubernetes networking
On GCE/GKE
• GCE Advanced Routes (program the fabric)
• “Everything to 10.1.1.0/24, send to this VM”
Plenty of other ways
• AWS: Route Tables
• Weave
• Calico
• Flannel
• OVS
• OpenContrail
• Cisco Contiv
• Others...
Pods
Pods
Small group of containers & volumes
Tightly coupled
The atom of scheduling & placement
Shared namespace
• share IP address & localhost
• share IPC, etc.
Managed lifecycle
• bound to a node, restart in place
• can die, cannot be reborn with same ID
Example: data puller & web server
Consumers
Content
Manager
File
Puller
Web
Server
Volume
Pod
Pods
Small group of containers & volumes
Tightly coupled
The atom of scheduling & placement
Shared namespace
• share IP address & localhost
• share IPC, etc.
Managed lifecycle
• bound to a node, restart in place
• can die, cannot be reborn with same ID
Example: data puller & web server
10.1.1.2
Pods
Small group of containers & volumes
Tightly coupled
The atom of scheduling & placement
Shared namespace
• share IP address & localhost
• share IPC, etc.
Managed lifecycle
• bound to a node, restart in place
• can die, cannot be reborn with same ID
Example: data puller & web server
c1
--net=container:infra
--ipc=container:infra
infra
10.1.1.2
c2
--net=container:infra
--ipc=container:infra
Services
Services
A group of pods that work together
• grouped by a selector
Defines access policy
• “load balanced” or “headless”
Gets a stable virtual IP and port
• sometimes called the service portal
• also a DNS name
VIP is managed by kube-proxy
• watches all services
• updates iptables when backends change
Hides complexity - ideal for non-native apps
Client
Virtual IP
kube-proxy
kube-proxy (legacy)
iptables
kube-proxy apiserver
Node X
iptables
apiserver
Node X
watch
services &
endpoints
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
kubectl run ...
watch
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
schedule
watch
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
watch
kubectl expose ...
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
new
service!
update
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
watch
kube-proxy (legacy)
kube-proxy
listen
iptables
apiserver
Node X
watch
kube-proxy (legacy)
kube-proxy
listen
iptables
apiserver
Node X
watch
configure
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
watch
VIP
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
new
endpoints!
update
VIP
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
VIP
watch
kube-proxy (legacy)
kube-proxy
iptables
apiserver
Node X
VIP
watch
kube-proxy (legacy)
kube-proxy
Client
iptables
apiserver
Node X
VIP
watch
kube-proxy (legacy)
kube-proxy
Client
iptables
apiserver
Node X
VIP
watch
kube-proxy (legacy)
kube-proxy
Client
iptables
apiserver
Node X
VIP
watch
kube-proxy (legacy)
kube-proxy
Client
kube-proxy (legacy)
Userspace proxy isn’t ideal
Burns CPU copying bytes
• “Proxy” is just parallel copy loops.
Loses source IP
• Everything looks like it’s from the node IP.
Userspace TCP listening = higher latency
iptables kube-proxy
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
watch
services &
endpoints
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
kubectl run ...
watch
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
schedule
watch
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
watch
kubectl expose ...
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
new
service!
update
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
watch
configure
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
watch
VIP
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
new
endpoints!
update
VIP
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
VIP
watch
configure
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
VIP
watch
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
VIP
watch
Client
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
VIP
watch
Client
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
VIP
watch
Client
iptables kube-proxy
iptables
kube-proxy apiserver
Node X
VIP
watch
Client
iptables kube-proxy Mean Latency
contrib/for-tests/netperf-tester --number=1000
Mean Latency Microseconds
iptables
kube-proxy
legacy
kube-proxy
Services are just an abstraction
• Only requirement: route (and maybe load
balance) a virtual IP to a set of backends.
Kube-proxy is an implementation
• Kube-proxy watches apiserver.
• iptables is re-configured on changes.
There could be other ways
• Userspace, iptables, IP Virtual Servers?
Services
DNS
Run SkyDNS as a pod in the cluster
• kube2sky bridges Kubernetes API -> SkyDNS
• Tell kubelets about it (static service IP)
Strictly optional, but practically required
• LOTS of things depend on it
• Probably will become more integrated
Or plug in your own!
kubernetes
kubernetes.default
kubernetes.default.svc.cluster.local
foo.my-namespace.svc.cluster.local
DNS
Run SkyDNS as a pod in the cluster
• kube2sky bridges Kubernetes API -> SkyDNS
• Tell kubelets about it (static service IP)
Strictly optional, but practically required
• LOTS of things depend on it
• Probably will become more integrated
Or plug in your own! apiserverwatch
etcd
kube-dns-qxin
kube2skyskyDNS
DNS
Run SkyDNS as a pod in the cluster
• kube2sky bridges Kubernetes API -> SkyDNS
• Tell kubelets about it (static service IP)
Strictly optional, but practically required
• LOTS of things depend on it
• Probably will become more integrated
Or plug in your own!
nameserver 10.0.0.10
...
/etc/resolv.conf
apiserverwatch
etcd
kube-dns-qxin
kube2skyskyDNS
DNS
Run SkyDNS as a pod in the cluster
• kube2sky bridges Kubernetes API -> SkyDNS
• Tell kubelets about it (static service IP)
Strictly optional, but practically required
• LOTS of things depend on it
• Probably will become more integrated
Or plug in your own!
nameserver 10.0.0.10
...
/etc/resolv.conf
apiserverwatch
etcd
kube-dns-qxin
kube2skyskyDNS
10.0.0.10
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client
What happens when I...
$ curl foo.my-namespace
Putting it Together
nameserver 10.0.0.10
...
/etc/resolv.conf
Client
10.1.0.1
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
etcd
kube-dns-qxin
kube2skyskyDNS
10.0.0.10
foo.my-namespace?
Client
Putting it Together
What happens when I...
$ curl foo.my-namespace
etcd
kube-dns-qxin
kube2skyskyDNS
10.0.0.10
10.0.123.45
Client
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
10.0.123.45Client
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
iptables
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
iptables
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
iptables
10.1.3.1
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
iptables
10.1.3.1
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
10.1.3.0/24 -> Node X
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
iptables
10.1.3.1
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client VIP10.0.123.45
iptables
10.1.3.1
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
Hello World!
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client
iptables
Hello World!
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client
iptables
Hello World!
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
10.1.0.0/24 -> Node Y
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
Client
iptables
Hello World!
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
10.1.0.0/24 -> Node Y
10.1.0.1
Putting it Together
What happens when I...
$ curl foo.my-namespace
Hello World!
Client
iptables
Hello World!
10.1.0.1
10.1.0.6 10.1.3.1 10.1.6.3
10.1.0.0/24 -> Node Y
10.1.0.1
What about external?
External Services
Services IPs are only available inside the
cluster
Need to receive traffic from “the outside
world”
Builtin: Service “type”
• nodePort: expose on a port on every node
• loadBalancer: provision a cloud load-balancer
DiY load-balancer solutions
• socat (for nodePort remapping)
• haproxy
• nginx
The Bleeding Edge
Ingress (L7)
Services are assumed L3/L4
Lots of apps want HTTP/HTTPS
Ingress maps incoming traffic to backend
services
• by HTTP host headers
• by HTTP URL paths
HAProxy and GCE implementations
No SSL yet
Status: BETA in Kubernetes v1.1
URL Map
Client
Ingress (L7)
Services are assumed L3/L4
Lots of apps want HTTP/HTTPS
Ingress maps incoming traffic to backend
services
• by HTTP host headers
• by HTTP URL paths
HAProxy and GCE implementations
No SSL yet
Status: BETA in Kubernetes v1.1
URL Map
Client
api.company.com
api.company.com/foo api.company.com/bar
othercompany.com/*
Network Plugins
Network Plugins
Introduced in Kubernetes v1.0
• VERY experimental
Uses CNI (CoreOS) in v1.1
• Simple exec interface
• Not using Docker libnetwork
• but can defer to Docker for networking
Cluster admins can customize their installs
• DHCP, MACVLAN, Flannel, custom
net
Plugin
Plugin
Plugin
Kubernetes is Open
- open community
- open design
- open source
- open to ideas
Networking is Hard
- help guide us!
http://kubernetes.io
https://github.com/kubernetes/kubernetes
slack: kubernetes twitter: @kubernetesio

More Related Content

PDF
DevJam 2019 - Introduction to Kubernetes
PPTX
A brief study on Kubernetes and its components
PDF
Kubernetes architecture
PPTX
Kubernetes 101 for Beginners
PDF
Introduction to kubernetes
PPTX
Kubernetes Basics
PDF
Kubernetes
PDF
Deep dive into Kubernetes Networking
DevJam 2019 - Introduction to Kubernetes
A brief study on Kubernetes and its components
Kubernetes architecture
Kubernetes 101 for Beginners
Introduction to kubernetes
Kubernetes Basics
Kubernetes
Deep dive into Kubernetes Networking

What's hot (20)

PPTX
Kubernetes Networking 101
PPTX
Kubernetes PPT.pptx
PDF
Kubernetes Basics
ODP
Kubernetes Architecture
PDF
An Introduction to Kubernetes
PDF
Kubernetes - introduction
PPTX
Kubernetes Introduction
PDF
Getting Started with Kubernetes
PDF
What Is Kubernetes | Kubernetes Introduction | Kubernetes Tutorial For Beginn...
PDF
Deploy Application on Kubernetes
PDF
Kubernetes
PDF
Introduction to Kubernetes Workshop
PDF
Introduction of Kubernetes - Trang Nguyen
PDF
Kubernetes 101
PDF
Introduction to kubernetes
PPTX
Introduction to kubernetes
PDF
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
PDF
Kubernetes Introduction
PPTX
Docker Networking Overview
PDF
Kubernetes: A Short Introduction (2019)
Kubernetes Networking 101
Kubernetes PPT.pptx
Kubernetes Basics
Kubernetes Architecture
An Introduction to Kubernetes
Kubernetes - introduction
Kubernetes Introduction
Getting Started with Kubernetes
What Is Kubernetes | Kubernetes Introduction | Kubernetes Tutorial For Beginn...
Deploy Application on Kubernetes
Kubernetes
Introduction to Kubernetes Workshop
Introduction of Kubernetes - Trang Nguyen
Kubernetes 101
Introduction to kubernetes
Introduction to kubernetes
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Introduction
Docker Networking Overview
Kubernetes: A Short Introduction (2019)
Ad

Viewers also liked (9)

PDF
Container Network Interface: Network Plugins for Kubernetes and beyond
PPTX
RancherのWindowsサポートと事始め
PDF
Load Balancing in the Cloud using Nginx & Kubernetes
PDF
Rancher による社内向けテナントサービス基盤
PDF
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
PDF
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
PDF
Beyond Ingresses - Better Traffic Management in Kubernetes
PDF
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
PDF
클라우드 네트워킹과 SDN 그리고 OpenStack
Container Network Interface: Network Plugins for Kubernetes and beyond
RancherのWindowsサポートと事始め
Load Balancing in the Cloud using Nginx & Kubernetes
Rancher による社内向けテナントサービス基盤
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
Beyond Ingresses - Better Traffic Management in Kubernetes
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
클라우드 네트워킹과 SDN 그리고 OpenStack
Ad

Similar to Kubernetes Networking (20)

PDF
Networking in Kubernetes
PPTX
Nynog-K8s-networking-101.pptx
PDF
Kubernetes at Datadog Scale
PDF
Kubernetes Networking 101 kubecon EU 2022
PPTX
KuberNETes - meetup
PDF
The Journey to the Kubernetes networking.pdf
PDF
Deep dive in container service discovery
PDF
Evolution of kube-proxy (Brussels, Fosdem 2020)
PDF
Container network security
PDF
Getting started with kubernetes
PPTX
Kubernetes #1 intro
PDF
Kubernetes Networking - Giragadurai Vallirajan
PPTX
Open stackaustinmeetupsept21
PPTX
Kubernetes Services are sooo Yesterday!
PPTX
Introduction+to+Kubernetes-Details-D.pptx
PDF
Kubernetes networking
PDF
Kubernetes from scratch at veepee sysadmins days 2019
PDF
Kubernetes - A Comprehensive Overview
PDF
Kubernetes acomprehensiveoverview
PDF
Kubernetes a comprehensive overview
Networking in Kubernetes
Nynog-K8s-networking-101.pptx
Kubernetes at Datadog Scale
Kubernetes Networking 101 kubecon EU 2022
KuberNETes - meetup
The Journey to the Kubernetes networking.pdf
Deep dive in container service discovery
Evolution of kube-proxy (Brussels, Fosdem 2020)
Container network security
Getting started with kubernetes
Kubernetes #1 intro
Kubernetes Networking - Giragadurai Vallirajan
Open stackaustinmeetupsept21
Kubernetes Services are sooo Yesterday!
Introduction+to+Kubernetes-Details-D.pptx
Kubernetes networking
Kubernetes from scratch at veepee sysadmins days 2019
Kubernetes - A Comprehensive Overview
Kubernetes acomprehensiveoverview
Kubernetes a comprehensive overview

Recently uploaded (20)

PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
ai tools demonstartion for schools and inter college
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administraation Chapter 3
PDF
System and Network Administration Chapter 2
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
ai tools demonstartion for schools and inter college
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Design an Analysis of Algorithms II-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
Upgrade and Innovation Strategies for SAP ERP Customers
How Creative Agencies Leverage Project Management Software.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Digital Strategies for Manufacturing Companies
System and Network Administraation Chapter 3
System and Network Administration Chapter 2
Design an Analysis of Algorithms I-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PTS Company Brochure 2025 (1).pdf.......
Softaken Excel to vCard Converter Software.pdf
Reimagine Home Health with the Power of Agentic AI​
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
2025 Textile ERP Trends: SAP, Odoo & Oracle

Kubernetes Networking