diff --git a/src/pages/use-cases/kubernetes/routing-peer.mdx b/src/pages/use-cases/kubernetes/routing-peer.mdx index 795d7ba8..31430c08 100644 --- a/src/pages/use-cases/kubernetes/routing-peer.mdx +++ b/src/pages/use-cases/kubernetes/routing-peer.mdx @@ -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.