-
Notifications
You must be signed in to change notification settings - Fork 24
refactor!: Modernize NetBird helm chart #46
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
base: main
Are you sure you want to change the base?
Changes from all commits
a3439fe
f5ec6ba
a81d085
ade9bba
d5518d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Netbird Self-Hosted Setup | ||
|
|
||
| This example provides a fully configured and tested setup for deploying Netbird using the following components: | ||
|
|
||
| - **Ingress Controller**: AWS ALB (HTTP) and NLB (STUN) | ||
| - **Database Storage**: PostgreSQL | ||
| - **Identity Provider**: Embedded (Dex) | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| This setup assumes you have an existing AWS EKS cluster (with the AWS Load Balancer Controller installed) and a PostgreSQL database installed and configured. | ||
|
|
||
| ## Kubernetes Secret Configuration | ||
|
|
||
| This setup requires Kubernetes secrets to store sensitive data. You'll need to create a secret named `netbird` in your Kubernetes cluster, containing the following key-value pairs: | ||
|
|
||
| - `relayAuthSecret`: `xxxxxx` # Password used to secure communication between peers in the relay service. | ||
| - `datastoreDsnPassword`: `xxxxxx` # Password for the PostgreSQL database connection. | ||
| - `datastoreEncryptionKey`: `xxxxxxx` # A random encryption key for the datastore, e.g., generated via `openssl rand -base64 32`. | ||
|
|
||
| > **Note:** The `datastoreEncryptionKey` must also be provided in a ConfigMap for the Netbird setup. | ||
|
|
||
| ## Deployment | ||
|
|
||
| Once the required secrets and configuration are in place, this setup will deploy all necessary services for running Netbird, including the following exposed endpoints: | ||
|
|
||
| - `netbird.example.com` - The main Netbird services (dashboard|server). | ||
|
|
||
| ## Additional info | ||
|
|
||
| While this setup also deploys the embedded STUN server, you will likely need to use a separate hostname for the ELB (since STUN cannot be served by ALB). It does not seem like NetBird allows configuring a separate hostname for the STUN server; it may be easier to simply use a public STUN server and configure it under `stuns` in the `config.yaml`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| management: | ||
| configYaml: |- | ||
| server: | ||
| listenAddress: :80 | ||
| exposedAddress: https://netbird.example.com:443 | ||
| stunPorts: [3478] | ||
| metricsPort: 9090 | ||
| healthcheckAddress: :9000 | ||
| logLevel: info | ||
| logFile: console | ||
| authSecret: "${NETBIRD_RELAY_AUTH_SECRET}" | ||
| dataDir: /var/lib/netbird | ||
| auth: | ||
| issuer: https://netbird.example.com/oauth2 | ||
| signKeyRefreshEnabled: true | ||
| dashboardRedirectURIs: | ||
| - https://netbird.example.com/nb-auth | ||
| - https://netbird.example.com/nb-silent-auth | ||
| cliRedirectURIs: | ||
| - http://localhost:53000/ | ||
| reverseProxy: | ||
| trustedHTTPProxies: | ||
| - 172.30.0.10/32 | ||
| store: | ||
| engine: postgres | ||
| dsn: >- | ||
| host=database.local | ||
| port=5432 | ||
| dbname=store_db | ||
| user=store_user | ||
| password=${NETBIRD_STORE_DSN_PASSWORD} | ||
| encryptionKey: "${NETBIRD_DATASTORE_ENC_KEY}" | ||
| activityStore: | ||
| engine: postgres | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slightly unrelated: Could we add a PostgreSQL subchart to spin up a separate instance?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could - but considering that this chart doesn't get looked at often, I would rather leave it up to Helm users to deploy separately. |
||
| dsn: >- | ||
| host=database.local | ||
| port=5432 | ||
| dbname=events_db | ||
| user=events_user | ||
| password=${NETBIRD_STORE_DSN_PASSWORD} | ||
| authStore: | ||
| engine: postgres | ||
| dsn: >- | ||
| host=database.local | ||
| port=5432 | ||
| sslmode=require | ||
| dbname=idp_db | ||
| user=idp_user | ||
| password=${NETBIRD_STORE_DSN_PASSWORD} | ||
| envsubst: | ||
| enabled: true | ||
| envFromSecret: | ||
| NETBIRD_RELAY_AUTH_SECRET: netbird/relayAuthSecret | ||
| NETBIRD_STORE_DSN_PASSWORD: netbird/datastoreDsnPassword | ||
| NETBIRD_DATASTORE_ENC_KEY: netbird/datastoreEncryptionKey | ||
| ingress: | ||
| enabled: true | ||
| className: alb | ||
| annotations: | ||
| alb.ingress.kubernetes.io/target-type: ip | ||
| alb.ingress.kubernetes.io/group.name: netbird | ||
| alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 443}]' | ||
| alb.ingress.kubernetes.io/load-balancer-name: netbird-alb | ||
| alb.ingress.kubernetes.io/scheme: internet-facing | ||
| alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:{region}:{account}:certificate/{id} | ||
| alb.ingress.kubernetes.io/load-balancer-attributes: idle_timeout.timeout_seconds=3600 | ||
| hosts: | ||
| - host: netbird.example.com | ||
| paths: | ||
| - path: /api | ||
| pathType: Prefix | ||
| - path: /ws-proxy | ||
| pathType: Prefix | ||
| - path: /oauth2 | ||
| pathType: Prefix | ||
| - path: /relay | ||
|
jackylamhk marked this conversation as resolved.
|
||
| pathType: Prefix | ||
| ingressGrpc: | ||
| enabled: true | ||
| className: alb | ||
| annotations: | ||
| alb.ingress.kubernetes.io/target-type: ip | ||
| alb.ingress.kubernetes.io/group.name: netbird | ||
| alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 443}]' | ||
| alb.ingress.kubernetes.io/backend-protocol-version: GRPC | ||
| alb.ingress.kubernetes.io/healthcheck-path: /management.ManagementService/isHealthy | ||
| alb.ingress.kubernetes.io/success-codes: "0" | ||
| hosts: | ||
| - host: netbird.example.com | ||
| paths: | ||
| - path: /management.ManagementService | ||
| pathType: Prefix | ||
| - path: /signalexchange.SignalExchange | ||
|
jackylamhk marked this conversation as resolved.
|
||
| pathType: Prefix | ||
| resources: | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| requests: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| persistentVolume: | ||
| enabled: false | ||
| dashboard: | ||
| ingress: | ||
| enabled: true | ||
| className: alb | ||
| annotations: | ||
| alb.ingress.kubernetes.io/target-type: ip | ||
| alb.ingress.kubernetes.io/group.name: netbird | ||
| alb.ingress.kubernetes.io/group.order: "10" | ||
| alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 443}]' | ||
| hosts: | ||
| - host: netbird.example.com | ||
| paths: | ||
| - path: / | ||
| pathType: Prefix | ||
| resources: | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| requests: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| env: | ||
| NETBIRD_MGMT_API_ENDPOINT: https://netbird.example.com | ||
| NETBIRD_MGMT_GRPC_API_ENDPOINT: https://netbird.example.com | ||
| AUTH_AUDIENCE: netbird-dashboard | ||
| AUTH_CLIENT_ID: netbird-dashboard | ||
| AUTH_CLIENT_SECRET: "" | ||
| AUTH_AUTHORITY: https://netbird.example.com/oauth2 | ||
| USE_AUTH0: false | ||
| AUTH_SUPPORTED_SCOPES: openid profile email groups | ||
| AUTH_REDIRECT_URI: /nb-auth | ||
| AUTH_SILENT_REDIRECT_URI: /nb-silent-auth | ||
| LETSENCRYPT_DOMAIN: none | ||
| extraManifests: | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: IngressClass | ||
| metadata: | ||
| name: alb | ||
| spec: | ||
| controller: ingress.k8s.aws/alb | ||
| - apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: netbird-stun | ||
|
jackylamhk marked this conversation as resolved.
|
||
| namespace: netbird | ||
| spec: | ||
| type: LoadBalancer | ||
| loadBalancerClass: service.k8s.aws/nlb | ||
| selector: | ||
| app.kubernetes.io/instance: netbird | ||
| app.kubernetes.io/name: netbird-management | ||
| ports: | ||
| - protocol: UDP | ||
| port: 3478 | ||
| targetPort: stun | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This YAML is so much nice than the old JSON config imho. It would be nicer if it wasn't a text-block though.