Skip to content

Commit 8a394f8

Browse files
committed
WIP
1 parent 9b2908d commit 8a394f8

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,62 @@ spec:
9494
containers:
9595
- image: yourimage
9696
name: container
97+
```
98+
99+
## Provisioning Networks (Ingress Functionality)
100+
101+
### Granting controller access to NetBird Management
102+
103+
#### Using Helm
104+
105+
1. Create a Service User on your NetBird dashboard (Must be Admin). [Doc](https://docs.netbird.io/how-to/access-netbird-public-api#creating-a-service-user).
106+
1. Create access token for the Service User (Must be Admin). [Doc](https://docs.netbird.io/how-to/access-netbird-public-api#creating-a-service-user).
107+
1. Add access token to your helm values file under `netbirdAPI.key`.
108+
1. Alternatively, provision secret in the same namespace as the operator and set the key `NB_API_KEY` to the access token generated.
109+
1. Then set `netbirdAPI.keyFromSecret` to the name of the secret created.
110+
1. Set `ingress.enabled` to `true`.
111+
1. Optionally, to provision network immediately, set `ingress.router.enabled` to `true`.
112+
1. Optionally, to provision 1 network per kubernetes namespace, set `ingress.namespacedNetworks` to `true`.
113+
1. Run `helm install` or `helm upgrade`.
114+
115+
#### Without Helm
97116

117+
1. Create access token.
118+
1. Expose access token to controller deployment with flag `--netbird-api-key`.
119+
120+
### Exposing a Service
121+
122+
> [!IMPORTANT]
123+
> Ingress DNS Resolution requires DNS Wildcard Routing to be enabled, and at least one DNS Nameserver configured for clients.
124+
125+
|Annotation|Description|Default|
126+
|---|---|---|
127+
|`netbird.io/expose`|Expose service using NetBird Network Resource||
128+
|`netbird.io/groups`|Comma-separated list of group names to assign to Network Resource|`{ClusterName}-{Namespace}-{Service}`|
129+
|`netbird.io/resource-name`|Network Resource name|`{Namespace}-{Service}`|
130+
|`netbird.io/policy`|Name of NBPolicy to propagate service ports as destination.||
131+
|`netbird.io/policy-ports`|Narrow down exposed ports in policy, leave empty for all ports.||
132+
|`netbird.io/policy-protocol`|Narrow down protocol for use in policy, leave empty for all protocols.||
133+
134+
### Managing Policies
135+
136+
1. Simply add policies under `ingress.policies`, for example.
137+
```yaml
138+
ingress:
139+
policies:
140+
default:
141+
name: Kubernetes Default Policy # Required
142+
description: Default # Optional
143+
sourceGroups: # Required
144+
- All
145+
ports: # Optional, resources annotated 'netbird.io/policy=default' will append to this
146+
- 443
147+
protocols: # Optional, restricts protocols allowed to resources, defaults to ['tcp', 'udp']
148+
- tcp
149+
- udp
150+
bidirectional: true # Optional, defaults to true
98151
```
152+
2. Reference policy in Services using `netbird.io/policy=default`, this will add relevant ports and destination groups to Policy.
99153

100154
## Contributing
101155

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: test
6+
name: test
7+
namespace: default
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: test
13+
strategy:
14+
rollingUpdate:
15+
maxSurge: 25%
16+
maxUnavailable: 25%
17+
type: RollingUpdate
18+
template:
19+
metadata:
20+
labels:
21+
app: test
22+
spec:
23+
containers:
24+
- image: nginx
25+
imagePullPolicy: Always
26+
name: nginx
27+
---
28+
apiVersion: v1
29+
kind: Service
30+
metadata:
31+
annotations:
32+
netbird.io/expose: "true"
33+
netbird.io/policy: default
34+
netbird.io/resource-name: nginx
35+
labels:
36+
app: test
37+
name: test
38+
namespace: default
39+
spec:
40+
ports:
41+
- name: http
42+
port: 80
43+
protocol: TCP
44+
targetPort: 80
45+
selector:
46+
app: test
47+
type: ClusterIP

examples/ingress/values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ingress:
2+
enabled: true
3+
router:
4+
enabled: true
5+
policies:
6+
default:
7+
name: Kubernetes Default Policy
8+
sourceGroups:
9+
- All
10+
11+
netbirdAPI:
12+
key: "nbp_m0LM9ZZvDUzFO0pY50iChDOTxJgKFM3DIqmZ" # Replace with valid NetBird Service Account token

0 commit comments

Comments
 (0)