Skip to content

netbirdio/kubernetes-operator

Repository files navigation

NetBird Kubernetes Operator

For easily provisioning access to Kubernetes resources using NetBird.

Description

This operator enables easily provisioning NetBird access on kubernetes clusters, allowing users to access internal resources directly.

Getting Started

Prerequisites

  • helm version 3+
  • kubectl version v1.11.3+.
  • Access to a Kubernetes v1.11.3+ cluster.
  • (Optional for Helm chart installation) Cert Manager.

To Deploy on the cluster

Using the install.yaml

kubectl create namespace netbird
kubectl apply -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/manifests/install.yaml

Using the Helm Chart

helm repo add netbirdio https://netbirdio.github.io/kubernetes-operator
helm install -n netbird netbird-operator netbirdio/netbird-operator

For more options, check the default values by running

helm show values netbirdio/netbird-operator

To Uninstall

Using install.yaml

kubectl delete -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/manifests/install.yaml
kubectl delete namespace netbird

Using helm

helm uninstall -n netbird netbird-operator

Provision pods with NetBird access

  1. Create a Setup Key in your NetBird console.
  2. Create a Secret object in the namespace where you need to provision NetBird access (secret name and field can be anything).
apiVersion: v1
stringData:
  setupkey: EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE
kind: Secret
metadata:
  name: test
  1. Create an NBSetupKey object referring to your secret.
apiVersion: netbird.io/v1
kind: NBSetupKey
metadata:
  name: test
spec:
  # Optional, overrides management URL for this setupkey only
  # defaults to https://api.netbird.io
  managementURL: https://netbird.example.com 
  secretKeyRef:
    name: test # Required
    key: setupkey # Required
  1. Annotate the pods you need to inject NetBird into with netbird.io/setup-key.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment
spec:
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
      annotations:
        netbird.io/setup-key: test # Must match the name of an NBSetupKey object in the same namespace
    spec:
      containers:
      - image: yourimage
        name: container

Contributing

Prerequisites

To be able to develop on this project, you need to have the following tools installed:

Running tests

Running unit tests

make test

Running E2E tests

kind create cluster # If not already created, you can check with `kind get clusters`
make test-e2e