You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/concepts/services-networking/_index.md
+97-52Lines changed: 97 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,58 +7,103 @@ description: >
7
7
8
8
## The Kubernetes network model
9
9
10
-
Every [`Pod`](/docs/concepts/workloads/pods/) in a cluster gets its own unique cluster-wide IP address
11
-
(one address per IP address family).
12
-
This means you do not need to explicitly create links between `Pods` and you
13
-
almost never need to deal with mapping container ports to host ports.
14
-
This creates a clean, backwards-compatible model where `Pods` can be treated
15
-
much like VMs or physical hosts from the perspectives of port allocation,
16
-
naming, service discovery, [load balancing](/docs/concepts/services-networking/ingress/#load-balancing),
17
-
application configuration, and migration.
18
-
19
-
Kubernetes imposes the following fundamental requirements on any networking
20
-
implementation (barring any intentional network segmentation policies):
21
-
22
-
* pods can communicate with all other pods on any other [node](/docs/concepts/architecture/nodes/)
23
-
without NAT
24
-
* agents on a node (e.g. system daemons, kubelet) can communicate with all
25
-
pods on that node
26
-
27
-
{{< note >}}
28
-
For those platforms that support `Pods` running in the host network (such as Linux), when pods are attached to the host network of a node they can still communicate with all pods on all nodes without NAT.
29
-
{{< /note >}}
30
-
31
-
This model is not only less complex overall, but it is principally compatible
32
-
with the desire for Kubernetes to enable low-friction porting of apps from VMs
33
-
to containers. If your job previously ran in a VM, your VM had an IP and could
34
-
talk to other VMs in your project. This is the same basic model.
35
-
36
-
Kubernetes IP addresses exist at the `Pod` scope - containers within a `Pod`
37
-
share their network namespaces - including their IP address and MAC address.
38
-
This means that containers within a `Pod` can all reach each other's ports on
39
-
`localhost`. This also means that containers within a `Pod` must coordinate port
40
-
usage, but this is no different from processes in a VM. This is called the
41
-
"IP-per-pod" model.
42
-
43
-
How this is implemented is a detail of the particular container runtime in use.
44
-
45
-
It is possible to request ports on the `Node` itself which forward to your `Pod`
46
-
(called host ports), but this is a very niche operation. How that forwarding is
47
-
implemented is also a detail of the container runtime. The `Pod` itself is
48
-
blind to the existence or non-existence of host ports.
49
-
50
-
Kubernetes networking addresses four concerns:
51
-
- Containers within a Pod [use networking to communicate](/docs/concepts/services-networking/dns-pod-service/) via loopback.
52
-
- Cluster networking provides communication between different Pods.
53
-
- The [Service](/docs/concepts/services-networking/service/) API lets you
54
-
[expose an application running in Pods](/docs/tutorials/services/connect-applications-service/)
55
-
to be reachable from outside your cluster.
56
-
-[Ingress](/docs/concepts/services-networking/ingress/) provides extra functionality
57
-
specifically for exposing HTTP applications, websites and APIs.
58
-
-[Gateway API](/docs/concepts/services-networking/gateway/) is an {{<glossary_tooltip text="add-on" term_id="addons">}}
59
-
that provides an expressive, extensible, and role-oriented family of API kinds for modeling service networking.
60
-
- You can also use Services to
61
-
[publish services only for consumption inside your cluster](/docs/concepts/services-networking/service-traffic-policy/).
10
+
The Kubernetes network model is built out of several pieces:
11
+
12
+
* Each [Pod](/docs/concepts/workloads/pods/) in a cluster gets its
13
+
own unique cluster-wide IP address.
14
+
15
+
* A pod has its own private network namespace which is shared by
16
+
all of the containers within the pod. Processes running in
17
+
different containers in the same pod can communicate with each
18
+
other over `localhost`.
19
+
20
+
* The _pod network_ (also called a cluster network) handles communication
21
+
between pods. It ensures that (barring intentional network
22
+
segmentation):
23
+
24
+
* All pods can communicate with all other pods, whether they are
25
+
on the same [node](/docs/concepts/architecture/nodes/) or on
26
+
different nodes. Pods can communicate with each other
27
+
directly, without the use of proxies or address translation
28
+
(NAT).
29
+
30
+
* (On Windows, this rule does not apply to host-network pods.)
31
+
32
+
* Agents on a node (such as system daemons, or kubelet) can
33
+
communicate with all pods on that node.
34
+
35
+
* The [Service](/docs/concepts/services-networking/service/) API
36
+
lets you provide a stable (long lived) IP address or hostname for a service implemented
37
+
by one or more backend pods, where the individual pods making up
to interact with the pod network implementation, so these
88
+
implementations are often called _CNI plugins_.
89
+
90
+
* Kubernetes provides a default implementation of service proxying,
91
+
called {{< glossary_tooltip term_id="kube-proxy">}}, but some pod
92
+
network implementations instead use their own service proxy that
93
+
is more tightly integrated with the rest of the implementation.
94
+
95
+
* NetworkPolicy is generally also implemented by the pod network
96
+
implementation. (Some simpler pod network implementations don't
97
+
implement NetworkPolicy, or an administrator may choose to
98
+
configure the pod network without NetworkPolicy support. In these
99
+
cases, the API will still be present, but it will have no effect.)
100
+
101
+
* There are many [implementations of the Gateway
102
+
API](https://gateway-api.sigs.k8s.io/implementations/), some of
103
+
which are specific to particular cloud environments, some more
104
+
focused on "bare metal" environments, and others more generic.
105
+
106
+
## {{% heading "whatsnext" %}}
62
107
63
108
The [Connecting Applications with Services](/docs/tutorials/services/connect-applications-service/) tutorial lets you learn about Services and Kubernetes networking with a hands-on example.
0 commit comments