Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
da25b122
Commit
da25b122
authored
Jul 07, 2015
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10786 from thockin/docs-networking
De-dup, cleanup, overhaul networking docs
parents
0947b271
2210220d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
24 deletions
+23
-24
networking.md
docs/design/networking.md
+0
-0
networking.md
docs/networking.md
+23
-24
No files found.
docs/design/networking.md
View file @
da25b122
This diff is collapsed.
Click to expand it.
docs/networking.md
View file @
da25b122
# Networking in Kubernetes
# Networking in Kubernetes
Kubernetes approaches networking somewhat differently than Docker does by
default. There are 4 distinct networking problems to solve:
1.
Highly-coupled container-to-container communications: this is solved by
[
pods
](
pods.md
)
and
`localhost`
communications.
2.
Pod-to-Pod communications: this is the primary focus of this document.
3.
Pod-to-Service communications: this is covered by
[
services
](
services.md
)
.
4.
External-to-Service communications: this is covered by
[
services
](
services.md
)
.
## Summary
## Summary
Kubernetes approaches networking somewhat differently that Docker's defaults.
Kubernetes assumes that pods can communicate with other pods, regardless of
We give every pod its own IP address allocated from an internal network, so you
which host they land on. We give every pod its own IP address so you do not
do not need to explicitly create links between communicating pods. To do this,
need to explicitly create links between pods and you almost never need to deal
you must set up your cluster networking correctly.
with mapping container ports to host ports. This creates a clean,
backwards-compatible model where pods can be treated much like VMs or physical
hosts from the perspectives of port allocation, naming, service discovery, load
balancing, application configuration, and migration.
Since pods can fail and be replaced with new pods with different IP addresses
To achieve this we must impose some requirements on how you set up your cluster
on different nodes, we do not recommend having a pod directly talk to the IP
networking.
address of another Pod. Instead, if a pod, or collection of pods, provide some
service, then you should create a
`service`
object spanning those pods, and
clients should connect to the IP of the service object. See
[
services
](
services.md
)
.
## Docker model
## Docker model
...
@@ -96,24 +103,16 @@ outbound internet access. A linux bridge (called `cbr0`) is configured to exist
...
@@ -96,24 +103,16 @@ outbound internet access. A linux bridge (called `cbr0`) is configured to exist
on that subnet, and is passed to docker's
`--bridge`
flag.
on that subnet, and is passed to docker's
`--bridge`
flag.
We start Docker with:
We start Docker with:
```
```
DOCKER_OPTS="--bridge
cbr0 --iptables=false --ip-masq=false"
DOCKER_OPTS="--bridge
=
cbr0 --iptables=false --ip-masq=false"
```
```
We set up this bridge on each node with SaltStack, in
This bridge is created by Kubelet (controlled by the
`--configure-cbr0=true`
[
container_bridge.py
](
../cluster/saltbase/salt/_states/container_bridge.py
)
.
flag) according to the
`Node`
's
`spec.podCIDR`
.
```
cbr0:
container_bridge.ensure:
- cidr: {{ grains['cbr-cidr'] }}
- mtu: 1460
```
Docker will now allocate
`Pod`
IPs from the
`cbr-cidr`
block. Containers
Docker will now allocate
IPs from the
`cbr-cidr`
block. Containers can reach
can reach each other and
`Nodes`
over the
`cbr0`
bridge. Those IPs are all
each other and
`Nodes`
over the
`cbr0`
bridge. Those IPs are all routable
routable
within the GCE project network.
within the GCE project network.
GCE itself does not know anything about these IPs, though, so it will not NAT
GCE itself does not know anything about these IPs, though, so it will not NAT
them for outbound internet traffic. To achieve that we use an iptables rule to
them for outbound internet traffic. To achieve that we use an iptables rule to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment