Add documentation for NetworkEgress (#861)

* Add documentation for NetworkEgress

* Update src/pages/use-cases/kubernetes/routing-peer.mdx

Co-authored-by: dmitri-netbird <dmitri.external@netbird.io>

* Update src/pages/use-cases/kubernetes/routing-peer.mdx

Co-authored-by: dmitri-netbird <dmitri.external@netbird.io>

* Update network egress section in routing-peer.mdx

Clarified the explanation of network egress traffic and its configuration in Kubernetes.

* Update routing-peer.mdx

---------

Co-authored-by: Jack Carter <128555021+SunsetDrifter@users.noreply.github.com>
Co-authored-by: dmitri-netbird <dmitri.external@netbird.io>
This commit is contained in:
Philip Laine
2026-08-03 11:54:05 +02:00
committed by GitHub
parent fe16bcbfed
commit 7df7793e0f

View File

@@ -84,3 +84,29 @@ spec:
```
Members of the `All` NetBird group can now reach the nginx service at `nginx.default.prod.company.internal` through the NetBird network.
## NetworkEgress
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 an 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 router, 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 an accompanying service with the same name for the egress resource. In this example the 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.