Add ingress feature to controller (#5)

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>
This commit is contained in:
M. Essam
2025-03-06 09:57:45 +01:00
committed by GitHub
co-authored by Maycon Santos
parent cea60745d2
commit 166091b8e0
54 changed files with 5992 additions and 189 deletions
+39 -77
View File
@@ -1,107 +1,69 @@
# NetBird Kubernetes Operator
For easily provisioning access to Kubernetes resources using NetBird.
https://github.com/user-attachments/assets/5472a499-e63d-4301-a513-ad84cfe5ca7b
## Description
This operator enables easily provisioning NetBird access on kubernetes clusters, allowing users to access internal resources directly.
This operator easily provides NetBird access on Kubernetes clusters, allowing users to access internal resources directly.
## Getting Started
### Prerequisites
- helm version 3+
- (Recommended) helm version 3+
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
- (Optional for Helm chart installation) Cert Manager.
- (Recommended) Cert Manager.
### To Deploy on the cluster
**Using the install.yaml**
### Deployment
> [!NOTE]
> Helm Installation method is recommended due to the automation of multiple settings within the deployment.
#### Using Helm
1. Add helm repository.
```sh
helm repo add netbirdio https://netbirdio.github.io/kubernetes-operator
```
2. (Recommended) Install [cert-manager](https://cert-manager.io/docs/installation/#default-static-install).
3. (Recommended) Create a values.yaml file, check `helm show values netbirdio/kubernetes-operator` for more info.
4. Install using `helm install --create-namespace -f values.yaml -n netbird netbird-operator netbirdio/kubernetes-operator`.
> Learn more about the values.yaml options [here](helm/kubernetes-operator/values.yaml) and [Granting controller access to NetBird Management](docs/usage.md#granting-controller-access-to-netbird-management).
#### Using install.yaml
> [!IMPORTANT]
> install.yaml only includes a very basic template for deploying a stripped-down version of Kubernetes-operator.
> This excludes any and all configurations for ingress capabilities and requires the cert-manager to be installed.
```sh
kubectl create namespace netbird
kubectl apply -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/manifests/install.yaml
kubectl apply -n netbird -f https://raw.githubusercontent.com/netbirdio/kubernetes-operator/refs/heads/main/manifests/install.yaml
```
**Using the Helm Chart**
### Version
Latest version: v0.1.0
```sh
helm repo add netbirdio https://netbirdio.github.io/kubernetes-operator
helm install -n netbird kubernetes-operator netbirdio/kubernetes-operator
```
Tested against:
|Distribution|Test status|
|---|---|
|Google GKE|Pass|
|AWS EKS|Pass|
|Azure AKS|Not tested|
|OpenShift|Not tested|
For more options, check the default values by running
```sh
helm show values netbirdio/kubernetes-operator
```
> We would love community feedback to improve the test matrix. Please submit a PR with your test results.
### To Uninstall
**Using install.yaml**
### Usage
```sh
kubectl delete -n netbird -f https://github.com/netbirdio/kubernetes-operator/releases/latest/manifests/install.yaml
kubectl delete namespace netbird
```
**Using helm**
```sh
helm uninstall -n netbird kubernetes-operator
```
### Provision pods with NetBird access
1. Create a Setup Key in your [NetBird console](https://docs.netbird.io/how-to/register-machines-using-setup-keys#using-setup-keys).
1. Create a Secret object in the namespace where you need to provision NetBird access (secret name and field can be anything).
```yaml
apiVersion: v1
stringData:
setupkey: EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE
kind: Secret
metadata:
name: test
```
1. Create an NBSetupKey object referring to your secret.
```yaml
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`.
```yaml
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
```
Check the usage of [usage.md](docs/usage.md) and examples.
## Contributing
### Prerequisites
To be able to develop on this project, you need to have the following tools installed:
To be able to develop this project, you need to have the following tools installed:
- [Git](https://git-scm.com/).
- [Make](https://www.gnu.org/software/make/).