Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: K8s network model diagrams #39069

Closed
wants to merge 1,029 commits into from

Conversation

chrismetz09
Copy link
Contributor

Initial incomplete diagrams addressing #32243.

This is incomplete but begins to follow an outline. Can be a broad topic so included comments inline.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. language/en Issues or PRs related to English language labels Jan 23, 2023
@k8s-ci-robot k8s-ci-robot added sig/docs Categorizes an issue or PR as relevant to SIG Docs. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 23, 2023
@netlify
Copy link

netlify bot commented Jan 23, 2023

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 5d78673
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/640642effb8eee00085888cc
😎 Deploy Preview https://deploy-preview-39069--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

without network address translation (NAT)
* pods can communicate with other pods on same or separate nodes using L2 bridging, native L3 (IPv4, IPv6) networking, or a CNI-specific form of tunnel encapsulation.

[//]: # (Not sure the agent communications is part of the K8s network model)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should show that a Pod running in host network mode can communicate with another Pod in normal cluster network mode, provided that they are both on the same Pod.

That might be something we save for a followup, but it's good to show it one day.

Also that some network architectures allow for this to happen even when the 2 Pods are on different modes, but that Kubernetes doesn't require or guarantee this.

Containers within a `Pod` can all reach each other's ports on
`localhost`.

{{< figure src="/docs/images/k8net-localhost-PodSameHost.drawio.svg" alt="k8s net arch2" class="diagram-large" caption="Figure 2. Container localhost and L2 bridging" >}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch out for assuming that the network plugin uses layer 2 techniques. A network plugin that works at the IP layer only (eg a Linux tun interface plus userland packet encapsulation and decapsulation) is a viable design.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.researchgate.net/figure/Kubernetes-Network-routing-to-export-the-services_fig1_337362475 includes an example of a diagram that doesn't rely on OSI layer 2 (although, given it shows Flannel, this is partly down to eliding some detail)

Another option is with text, to highlight that this is one of several viable designs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understand re: L2-based and other network paradigms. Referenced paper is "researchy" but your point is valid.

Might call for Advanced Topics section later on that covers other paradigms like User-space networking (kernel bypass), Network Service Mesh, maybe eBPF, CNFs, ...

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 24, 2023
@tengqm
Copy link
Contributor

tengqm commented Jan 26, 2023

@chrismetz09
Copy link
Contributor Author

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more feedback. I hope this helps frame the explanation @chrismetz09


The Kubernetes network model introduces an architecture that allows you to support your cluster networking requirements.

Figure 1 illustrates the general Kubernetes network architecture.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Figure 1 illustrates the general Kubernetes network architecture.
Figure 1 shows one example implementation of networking for Kubernetes.
  • layer 2 bridges aren't required
  • there doesn't need to be an overlay network
  • pod-to-pod traffic doesn't even need to go over the interface used for host networking

Perhaps it'll help to show more than one image with detailed examples. Once we have those, maybe it'll be more obvious which elements are common.

content/en/docs/concepts/services-networking/_index.md Outdated Show resolved Hide resolved

The components of the architecture consist of the following:

* Nodes that can be virtual (VM) or physical.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Nodes that can be virtual (VM) or physical.
* Multiple servers (nodes); these can be physical hosts or virtual machines


* Nodes that can be virtual (VM) or physical.

* Pods configured on each node with one or more containers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Pods configured on each node with one or more containers.
* Pods running on each node. Each Pod has one or more containers.

consider showing a node that doesn't have any workload Pods running?

content/en/docs/concepts/services-networking/_index.md Outdated Show resolved Hide resolved
content/en/docs/concepts/services-networking/_index.md Outdated Show resolved Hide resolved

Some platforms, such as Linux, support pods running in the host network. Pods attached to the host network of a node can still communicate with all pods on all nodes without NAT.

## Terminology
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add these to the glossary and then use shortcodes to repeat (include) the definitions here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

* containers in same pod can communicate with each other.
* pods can communicate with all other pods on the same or separate [nodes](/docs/concepts/architecture/nodes/)
without network address translation (NAT).
* pods can communicate with other pods on the same or separate nodes using L2 bridging, native L3 (IPv4, IPv6) networking, tunneling, or other techniques for conveying packets from one pod to another.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* pods can communicate with other pods on the same or separate nodes using L2 bridging, native L3 (IPv4, IPv6) networking, tunneling, or other techniques for conveying packets from one pod to another.
* pods can communicate with other pods on the same or separate nodes using layer 2 bridging, native layer 3 (IPv4, IPv6) networking, tunneling, or other techniques for conveying packets from one pod to another.

content/en/docs/concepts/services-networking/_index.md Outdated Show resolved Hide resolved

Figure 1 illustrates the general Kubernetes network architecture.

{{< figure src="/docs/images/k8net-Pod-arch-template.drawio.svg" alt="k8s net arch" class="diagram-large" caption="Figure 1. K8s Network Architecture" >}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{< figure src="/docs/images/k8net-Pod-arch-template.drawio.svg" alt="k8s net arch" class="diagram-large" caption="Figure 1. K8s Network Architecture" >}}
{{< figure src="/docs/images/k8net-Pod-arch-template.drawio.svg" alt="k8s net arch" class="diagram-large" caption="Figure 1. Example network architecture for a cluster" >}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a two examples to this section so figure captions will change.

* L2bridge is a virtual L2 bridge that allows attachment, configuration and communications between pods on the same node. Depending on your deployment of container runtimes and CNI, you might know this entity as a `linux bridge`, `docker0`, `cbr0` or `cni0`.

* CNI plugins supporting different techniques for pod networking that include virtual overlay networks and physical underlay networks. You can choose from any number of different CNI plugins to best meet your cluster networking requirements.
* L2bridge is a virtual L2 bridge that allows attachment, configuration and communications between pods on the same node. Depending on your deployment of container runtimes and CNI, you might know this entity as a `linux bridge`, `docker0`, `cbr0` or `cni0`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap this long line as we do for line 89-95?

@@ -30,7 +30,7 @@ implementation (barring any intentional network segmentation policies):
* Containers in same pod can communicate with each other.
* Pods can communicate with all other pods on the same or separate [nodes](/docs/concepts/architecture/nodes/)
without network address translation (NAT).
* Pods can communicate with other pods on the same or separate nodes using L2 bridging, native L3 (IPv4, IPv6) networking, tunneling, or other techniques for conveying packets from one pod to another.
* Pods can communicate with other pods on the same or separate nodes using layer 2 bridging, native layer 3 (IPv4, IPv6) networking, tunneling, or other techniques for conveying packets from one pod to another.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap this long line?

@sftim
Copy link
Contributor

sftim commented Feb 16, 2023

Thanks again @chrismetz09

Overall, if you frame this as “here are some examples of valid cluster networking” (and not accidentally imply “this shows how it always is done”), I think we're actually close to being able to merge something. And then, we can iterate.

@k8s-ci-robot k8s-ci-robot added language/uk Issues or PRs related to Ukrainian language language/zh Issues or PRs related to Chinese language sig/release Categorizes an issue or PR as relevant to SIG Release. labels Mar 3, 2023
@sftim
Copy link
Contributor

sftim commented Mar 7, 2023

Hi @chrismetz09 - would you like help rebasing this PR to touch fewer files?

@chrismetz09
Copy link
Contributor Author

@sftim, is this the standard rebase to squash my multiple commits into one? Looks like this is something different? If so, yes guidance please.

@sftim
Copy link
Contributor

sftim commented Mar 7, 2023

This PR stands to change 697 files. Doesn't look right. Let's fix that.

@chrismetz09
Copy link
Contributor Author

It is not right for sure.

@chrismetz09
Copy link
Contributor Author

Probing for a solution. Would this work?

1. Sync fork repo with main
2. Get the new changes on main: git fetch && git checkout main && git pull origin main
3. Rebase your branch on main git checkout <name of your branch> && git rebase -i main
4. squash my commits into one.
5. git push the single squashed commit to my remote devBranch

@chrismetz09
Copy link
Contributor Author

Working new branch called net-model-diagrams in PR #39890

@chrismetz09
Copy link
Contributor Author

/close

@k8s-ci-robot
Copy link
Contributor

@chrismetz09: Closed this PR.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jihoon-seo
Copy link
Member

/remove-area blog release-eng
/remove-language de es fr hi id it ja ko pl pt ru uk zh
/remove-sig release

@k8s-ci-robot k8s-ci-robot removed area/blog Issues or PRs related to the Kubernetes Blog subproject area/release-eng Issues or PRs related to the Release Engineering subproject language/de Issues or PRs related to German language language/es Issues or PRs related to Spanish language language/fr Issues or PRs related to French language language/hi Issues or PRs related to Hindi language language/id Issues or PRs related to Indonesian language language/it Issues or PRs related to Italian language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/pl Issues or PRs related to Polish language language/pt Issues or PRs related to Portuguese language language/ru Issues or PRs related to Russian language language/uk Issues or PRs related to Ukrainian language language/zh Issues or PRs related to Chinese language sig/release Categorizes an issue or PR as relevant to SIG Release. labels Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.