Skip to content

Add documentation for NetworkEgress#861

Open
phillebaba wants to merge 1 commit into
netbirdio:mainfrom
phillebaba:network-egress
Open

Add documentation for NetworkEgress#861
phillebaba wants to merge 1 commit into
netbirdio:mainfrom
phillebaba:network-egress

Conversation

@phillebaba

@phillebaba phillebaba commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This documents the basics for using the new egress feature implemented in the operator.

netbirdio/kubernetes-operator#357


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Documentation
    • Added guidance for using Kubernetes routing peers with NetworkEgress resources.
    • Documented targeting egress destinations by FQDN or IP address.
    • Added details about destination port handling and automatic Kubernetes service discovery.
    • Included a YAML example and expected HTTP request behavior.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Kubernetes routing peer documentation now includes NetworkEgress guidance, covering target configuration, destination port rewriting, service discovery, a YAML example, and expected HTTP behavior.

Changes

Kubernetes egress documentation

Layer / File(s) Summary
NetworkEgress routing peer guide
src/pages/use-cases/kubernetes/routing-peer.mdx
Documents NetworkEgress targets, randomized destination ports, accompanying Kubernetes services, configuration examples, and expected HTTP requests.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: sunsetdrifter

Poem

A rabbit hops through routes anew,
With egress paths and services too.
YAML blooms beside the nginx door,
Requests now reach the peer’s far shore.
Hop, hop—docs guide the way!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding documentation for NetworkEgress.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/use-cases/kubernetes/routing-peer.mdx`:
- Around line 90-92: Correct the spelling and grammar in the network egress
documentation paragraph: change “a IP” to “an IP,” “rotuer” to “router,” “a
accompanying” to “an accompanying,” and “he target” to “the target.”
- Around line 90-92: Replace every occurrence of the internal-looking
prod.company.internal hostname in the routing-peer MDX example, including the
referenced lines, with the fictional placeholder example.com. Keep the hostname
usage and example behavior unchanged.
- Around line 92-112: Update the NetworkEgress example metadata.name from nginx
to a distinct name such as nginx-egress, avoiding conflict with the existing
Service/nginx; also update the subsequent HTTP request hostname to use the
generated egress Service name while preserving the namespace and cluster-local
format.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d9034298-abb5-49cb-889d-5a9de7fbda97

📥 Commits

Reviewing files that changed from the base of the PR and between 31f2b6c and 5d56798.

📒 Files selected for processing (1)
  • src/pages/use-cases/kubernetes/routing-peer.mdx

Comment on lines +90 to +92
The network router can also be used for egress traffic to reach other peers within the NetBird network. The network egress resource defines the target and links it to a network router. The target can either be a FQDN hostname or a IP address. Generally using a hostname is preferable especially if the target resource is hosted in another Kubernetes cluster. Egress through the network router works by assigning a random destination port for each network egress resource. This way the destination address and port can be rewritten before reaching the tunnel. Native Kubernetes services are used for directing the traffic to the network rotuer, meaning normal service discovery can be used for external peers.

Create a network egress resource in the namespace where it will be consumed. The operator will create a accompanying service with the same name for the egress resource. In this example he target is the nginx deployment from the network resource example.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the spelling and grammar errors.

Please change a IP to an IP, rotuer to router, a accompanying to an accompanying, and he target to the target.

🧰 Tools
🪛 LanguageTool

[grammar] ~90-~90: Ensure spelling is correct
Context: ...or directing the traffic to the network rotuer, meaning normal service discovery can b...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/use-cases/kubernetes/routing-peer.mdx` around lines 90 - 92,
Correct the spelling and grammar in the network egress documentation paragraph:
change “a IP” to “an IP,” “rotuer” to “router,” “a accompanying” to “an
accompanying,” and “he target” to “the target.”

Source: Linters/SAST tools


🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Replace the internal-looking hostname with a placeholder.

prod.company.internal is an internal hostname pattern and is repeated in the new example. Use a clearly fictional placeholder domain consistently throughout the example, such as example.com.

As per coding guidelines, MDX content must not include internal hostnames; use placeholders instead.

Also applies to: 104-106

🧰 Tools
🪛 LanguageTool

[grammar] ~90-~90: Ensure spelling is correct
Context: ...or directing the traffic to the network rotuer, meaning normal service discovery can b...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/use-cases/kubernetes/routing-peer.mdx` around lines 90 - 92,
Replace every occurrence of the internal-looking prod.company.internal hostname
in the routing-peer MDX example, including the referenced lines, with the
fictional placeholder example.com. Keep the hostname usage and example behavior
unchanged.

Source: Coding guidelines

Comment on lines +92 to +112
Create a network egress resource in the namespace where it will be consumed. The operator will create a accompanying service with the same name for the egress resource. In this example he target is the nginx deployment from the network resource example.

```yaml
apiVersion: netbird.io/v1alpha1
kind: NetworkEgress
metadata:
name: nginx
namespace: default
spec:
networkRouterRef:
name: prod
namespace: netbird
target:
fqdn:
hostname: nginx.default.prod.company.internal
ports:
- name: http
port: 80
```

Once the network egress resource has been reconciled an HTTP request to `nginx.default.svc.cluster.local.` should reach the external resource.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Avoid reusing the existing nginx Service name.

The preceding example already creates Service/nginx in the default namespace. Since this resource also instructs the operator to create an accompanying Service named nginx, reconciliation will conflict with the existing Service. Use a distinct egress name, such as nginx-egress, and update the request hostname accordingly.

Proposed fix
 metadata:
-  name: nginx
+  name: nginx-egress
...
-Once the network egress resource has been reconciled an HTTP request to `nginx.default.svc.cluster.local.` should reach the external resource.
+Once the network egress resource has been reconciled, an HTTP request to `nginx-egress.default.svc.cluster.local.` should reach the target resource.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Create a network egress resource in the namespace where it will be consumed. The operator will create a accompanying service with the same name for the egress resource. In this example he target is the nginx deployment from the network resource example.
```yaml
apiVersion: netbird.io/v1alpha1
kind: NetworkEgress
metadata:
name: nginx
namespace: default
spec:
networkRouterRef:
name: prod
namespace: netbird
target:
fqdn:
hostname: nginx.default.prod.company.internal
ports:
- name: http
port: 80
```
Once the network egress resource has been reconciled an HTTP request to `nginx.default.svc.cluster.local.` should reach the external resource.
Create a network egress resource in the namespace where it will be consumed. The operator will create a accompanying service with the same name for the egress resource. In this example he target is the nginx deployment from the network resource example.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/use-cases/kubernetes/routing-peer.mdx` around lines 92 - 112,
Update the NetworkEgress example metadata.name from nginx to a distinct name
such as nginx-egress, avoiding conflict with the existing Service/nginx; also
update the subsequent HTTP request hostname to use the generated egress Service
name while preserving the namespace and cluster-local format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant