Skip to content

Add reverse proxy helm chart - #32

Open
lixmal wants to merge 14 commits into
mainfrom
feature/netbird-proxy
Open

Add reverse proxy helm chart#32
lixmal wants to merge 14 commits into
mainfrom
feature/netbird-proxy

Conversation

@lixmal

@lixmal lixmal commented Feb 10, 2026

Copy link
Copy Markdown

Summary

Adds a Helm chart for deploying the NetBird reverse proxy.

Kubernetes Resources

Resource Condition Description
Deployment Always Proxy deployment with health probes, configurable cert and data volumes
Service Always Dual-stack (IPv4/IPv6) support, conditional ACME HTTP, NetBird UDP, and extra ports
ServiceAccount serviceAccount.create With configurable token automount (required for k8s-lease cert locking)
Secret proxyToken set (no existingSecret) Proxy token and optional OIDC client secret
PersistentVolumeClaim certVolume.enabled or geolocation.volume.enabled Shared certificate storage and geolocation database
Role rbac.create Grants Kubernetes lease permissions for ACME certificate locking
RoleBinding Same as Role Binds the lease Role to the ServiceAccount
HorizontalPodAutoscaler autoscaling.enabled CPU and memory based autoscaling
PodDisruptionBudget podDisruptionBudget.enabled Configurable minAvailable or maxUnavailable
NetworkPolicy networkPolicy.enabled Restricts ingress to proxy ports with support for additional custom rules
ServiceMonitor serviceMonitor.enabled Prometheus scraping on the health port

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a complete Helm chart for deploying netbird-proxy on Kubernetes (Deployment, Service, ServiceAccount).
    • Enabled optional HPA, NetworkPolicy, PodDisruptionBudget, and Prometheus ServiceMonitor.
    • Added configurable support for ACME certificates, OIDC, geolocation storage, CrowdSec, proxy protocol, and extra/custom ports and environment options.
  • Documentation
    • Added post-deployment access instructions and configuration notes for ACME and proxy protocol.

@lixmal
lixmal force-pushed the feature/netbird-proxy branch from 17830b8 to 2458171 Compare March 19, 2026 05:53
@EvantAiI

Copy link
Copy Markdown

Hello when do you think the chart will be ready to deploy ?
Does the maintainer of the repo reviewed the pr ? Cause i don't see any movements from the owners unless the kube-operator...

@jackylamhk jackylamhk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We should probably add a secret mount for static TLS certs. As the certs mount is always present, users cannot currently mount it via extraVolumes and extraVolumeMounts.

Comment thread charts/netbird-proxy/values.yaml
Comment thread charts/netbird-proxy/templates/deployment.yaml
@lixmal

lixmal commented May 17, 2026

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f8cca7d-3a91-46ef-9379-9ce3913744ac

📥 Commits

Reviewing files that changed from the base of the PR and between e371f50 and 2b82c2c.

📒 Files selected for processing (2)
  • charts/netbird-proxy/templates/deployment.yaml
  • charts/netbird-proxy/values.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • charts/netbird-proxy/values.yaml
  • charts/netbird-proxy/templates/deployment.yaml

📝 Walkthrough

Walkthrough

This PR introduces a complete Helm chart for deploying netbird-proxy to Kubernetes. It defines chart metadata, configuration values, reusable helpers, workload and service templates, optional security and storage resources, autoscaling, monitoring, network policies, and post-deployment instructions.

Changes

NetBird Proxy Helm Chart

Layer / File(s) Summary
Chart Metadata, Values, and Helpers
charts/netbird-proxy/Chart.yaml, charts/netbird-proxy/values.yaml, charts/netbird-proxy/templates/_helpers.tpl
Defines chart metadata, deployment defaults, and helper templates for names, labels, service accounts, secrets, ports, and OIDC references.
Core Workload Deployment
charts/netbird-proxy/templates/deployment.yaml
Renders the Deployment, proxy container, ports, environment variables, probes, volumes, security settings, and scheduling constraints.
Service Exposure and Network Controls
charts/netbird-proxy/templates/service.yaml, charts/netbird-proxy/templates/networkpolicy.yaml
Adds configurable Service exposure and optional ingress restrictions for HTTPS, health, ACME, debug, NetBird UDP, and extra ports.
Identity, Secrets, and ACME RBAC
charts/netbird-proxy/templates/serviceaccount.yaml, charts/netbird-proxy/templates/secret.yaml, charts/netbird-proxy/templates/role.yaml, charts/netbird-proxy/templates/rolebinding.yaml
Creates optional service accounts and secrets, plus lease permissions for ACME certificate locking.
Storage, Scaling, Availability, Monitoring, and Guidance
charts/netbird-proxy/templates/pvc.yaml, charts/netbird-proxy/templates/hpa.yaml, charts/netbird-proxy/templates/pdb.yaml, charts/netbird-proxy/templates/servicemonitor.yaml, charts/netbird-proxy/templates/NOTES.txt
Adds conditional storage, scaling, disruption protection, monitoring, and post-installation instructions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HelmValues
  participant Kubernetes
  participant ProxyPod
  participant Service
  participant HealthMonitor
  HelmValues->>Kubernetes: Render Deployment and optional resources
  Kubernetes->>ProxyPod: Start configured netbird-proxy container
  Service->>ProxyPod: Route HTTPS, health, and optional listener traffic
  HealthMonitor->>Service: Scrape configured health endpoint
Loading

Poem

🐰 A proxy chart hops into the stack,
With ports and secrets neatly packed.
ACME locks and probes align,
PVCs and scaling signs shine.
Kubernetes now knows the way—
NetBird leaps into deploy day!

🚥 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 summarizes the main change: adding a reverse proxy Helm chart.
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
  • Commit unit tests in branch feature/netbird-proxy

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

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 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 `@charts/netbird-proxy/templates/hpa.yaml`:
- Around line 15-31: The HPA manifest renders a bare "metrics:" header when
neither .Values.autoscaling.targetCPUUtilizationPercentage nor
.Values.autoscaling.targetMemoryUtilizationPercentage is set, producing invalid
YAML; update the template to conditionally emit the entire metrics block only
when at least one target is configured by wrapping the existing metrics: section
and its two conditional resource entries inside a single outer conditional that
checks .Values.autoscaling.targetCPUUtilizationPercentage or
.Values.autoscaling.targetMemoryUtilizationPercentage so that spec.metrics is
omitted entirely when both are unset.

In `@charts/netbird-proxy/templates/pdb.yaml`:
- Around line 12-17: Change the PDB template to treat explicit 0 as a valid
value and prevent both fields from being rendered together: replace the current
truthy checks with nil-checks against .Values.podDisruptionBudget.minAvailable
and .Values.podDisruptionBudget.maxUnavailable (use the Helm "ne" nil test) so 0
is allowed, and add a mutual-exclusivity validation (e.g., a short template that
fails with a clear message if both .Values.podDisruptionBudget.minAvailable and
.Values.podDisruptionBudget.maxUnavailable are non-nil) to ensure only one of
minAvailable or maxUnavailable is rendered.

In `@charts/netbird-proxy/templates/role.yaml`:
- Line 1: Update the template conditional so Role creation is allowed when RBAC
is enabled and the ACME lock method is k8s-lease even if an existing
ServiceAccount is reused; replace the current check that requires
.Values.serviceAccount.create with a compound condition that requires
.Values.rbac.create and (the ACME lock method equals "k8s-lease") and (either
.Values.serviceAccount.create is true OR a user-supplied ServiceAccount name is
present), and apply the same conditional change in the corresponding RoleBinding
template.

In `@charts/netbird-proxy/templates/secret.yaml`:
- Around line 1-11: When creating the Secret resource guarded by
.Values.existingSecret, ensure we fail-fast if the proxy token is missing:
inside the template that renders the Secret (the block that uses {{- if not
.Values.existingSecret }} and creates the Secret with token: {{
.Values.proxyToken | b64enc }}), add a Helm required check such as {{ required
"proxyToken must be set when existingSecret is not provided" .Values.proxyToken
}} before using .Values.proxyToken (or change the outer condition to require
both not .Values.existingSecret and .Values.proxyToken) so the chart render
fails clearly instead of emitting an empty token Secret.

In `@charts/netbird-proxy/templates/service.yaml`:
- Around line 37-42: The Service currently exposes the acme-http port whenever
.Values.acme.enabled is true; change the Helm conditional to only render the
acme-http port when the ACME challenge type is http-01 (e.g. replace or extend
the guard to check .Values.acme.challengeType == "http-01") so the named port
"acme-http" and port value .Values.service.acmePort are only emitted for
http-01; apply the identical conditional change in the other templates (the
Deployment containerPort entry named "acme-http" and any related port
definitions in networkpolicy.yaml) so all three templates (service, deployment,
networkpolicy) only expose/allow the acme-http port when
.Values.acme.challengeType == "http-01" and omit it otherwise.

In `@charts/netbird-proxy/values.yaml`:
- Around line 3-6: The image repository value is wrong: update the
image.repository entry (currently "netbird-proxy") to the correct official
Docker Hub image "netbirdio/reverse-proxy" so Helm will pull the correct image
for deployment; edit the image block (the repository key) in values.yaml to
replace netbird-proxy with netbirdio/reverse-proxy.
🪄 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: 615f5362-7919-47b5-8636-a9e69e1a46e3

📥 Commits

Reviewing files that changed from the base of the PR and between 2aec0e9 and dde868a.

📒 Files selected for processing (15)
  • charts/netbird-proxy/Chart.yaml
  • charts/netbird-proxy/templates/NOTES.txt
  • charts/netbird-proxy/templates/_helpers.tpl
  • charts/netbird-proxy/templates/deployment.yaml
  • charts/netbird-proxy/templates/hpa.yaml
  • charts/netbird-proxy/templates/networkpolicy.yaml
  • charts/netbird-proxy/templates/pdb.yaml
  • charts/netbird-proxy/templates/pvc.yaml
  • charts/netbird-proxy/templates/role.yaml
  • charts/netbird-proxy/templates/rolebinding.yaml
  • charts/netbird-proxy/templates/secret.yaml
  • charts/netbird-proxy/templates/service.yaml
  • charts/netbird-proxy/templates/serviceaccount.yaml
  • charts/netbird-proxy/templates/servicemonitor.yaml
  • charts/netbird-proxy/values.yaml

Comment thread charts/netbird-proxy/templates/hpa.yaml
Comment thread charts/netbird-proxy/templates/pdb.yaml Outdated
Comment thread charts/netbird-proxy/templates/role.yaml Outdated
Comment thread charts/netbird-proxy/templates/secret.yaml
Comment thread charts/netbird-proxy/templates/service.yaml Outdated
Comment thread charts/netbird-proxy/values.yaml
- Add certVolume.existingSecret to mount a TLS Secret (cert-manager)
- Fix image repository to netbirdio/reverse-proxy
- Gate ACME HTTP port on http-01 challenge in service, deployment, networkpolicy
- Require proxyToken when existingSecret is not provided
- Allow Role/RoleBinding when serviceAccount.name is set without create
- Treat PDB minAvailable/maxUnavailable 0 as valid and fail on mutual exclusivity
- Omit HPA metrics block when no targets are set
- Document crowdsec.existingSecret requirement when top-level existingSecret is used
@lixmal

lixmal commented May 17, 2026

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
charts/netbird-proxy/templates/pvc.yaml (1)

11-12: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Quote the rendered storageClassName values.

An unset value is handled correctly, but a conventional "-" value renders as invalid YAML (storageClassName: -). Apply | quote to both PVC templates.

Also applies to: 29-30

🤖 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 `@charts/netbird-proxy/templates/pvc.yaml` around lines 11 - 12, Update the
storageClassName fields in both PVC templates, including the block guarded by
certVolume.storageClass, to render the configured value through the Helm quote
function. Preserve the existing conditional behavior for unset values while
ensuring conventional "-" values produce valid quoted YAML.
🤖 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.

Outside diff comments:
In `@charts/netbird-proxy/templates/pvc.yaml`:
- Around line 11-12: Update the storageClassName fields in both PVC templates,
including the block guarded by certVolume.storageClass, to render the configured
value through the Helm quote function. Preserve the existing conditional
behavior for unset values while ensuring conventional "-" values produce valid
quoted YAML.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f13fce84-9dd7-439a-b12b-b8c49da15b68

📥 Commits

Reviewing files that changed from the base of the PR and between dde868a and ff20871.

📒 Files selected for processing (10)
  • charts/netbird-proxy/templates/deployment.yaml
  • charts/netbird-proxy/templates/hpa.yaml
  • charts/netbird-proxy/templates/networkpolicy.yaml
  • charts/netbird-proxy/templates/pdb.yaml
  • charts/netbird-proxy/templates/pvc.yaml
  • charts/netbird-proxy/templates/role.yaml
  • charts/netbird-proxy/templates/rolebinding.yaml
  • charts/netbird-proxy/templates/secret.yaml
  • charts/netbird-proxy/templates/service.yaml
  • charts/netbird-proxy/values.yaml
🚧 Files skipped from review as they are similar to previous changes (6)
  • charts/netbird-proxy/templates/pdb.yaml
  • charts/netbird-proxy/templates/networkpolicy.yaml
  • charts/netbird-proxy/templates/service.yaml
  • charts/netbird-proxy/templates/hpa.yaml
  • charts/netbird-proxy/templates/secret.yaml
  • charts/netbird-proxy/templates/deployment.yaml

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.

3 participants