controller

This commit is contained in:
2026-03-23 21:45:12 +00:00
parent 48740f1da0
commit 3449945d0d
4 changed files with 63 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: netbox-ip-controller
rules:
- apiGroups: [""]
resources: ["pods", "services"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: netbox-ip-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: netbox-ip-controller
subjects:
- kind: ServiceAccount
name: default
namespace: netbox

31
netbox/controller.yaml Normal file
View File

@@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: netbox-ip-controller
namespace: netbox
spec:
replicas: 1
selector:
matchLabels:
app: netbox-ip-controller
template:
metadata:
labels:
app: netbox-ip-controller
spec:
containers:
- name: controller
image: ghcr.io/digitalocean/netbox-ip-controller:latest
args:
- --netbox-api-url=https://netbox.apps.undercloud.dev
- --netbox-token=$(NETBOX_TOKEN)
- --dual-stack-ip=true
- --service-publish-labels=netbox-export
# disable pod export (recommended)
- --pod-publish-labels=netbox-export
env:
- name: NETBOX_TOKEN
valueFrom:
secretKeyRef:
name: netbox-token
key: token

View File

@@ -127,6 +127,7 @@ metadata:
namespace: netbox
labels:
app: netbox
netbox-export: "true"
spec:
internalTrafficPolicy: Cluster
ipFamilies:

View File

@@ -28,3 +28,12 @@ stringData:
username: admin
email: admin@example.com
password: 4IsTheMindKiller
---
apiVersion: v1
kind: Secret
metadata:
name: netbox-token
namespace: netbox
type: Opaque
stringData:
token: JvWamlvHZTl4Cq0wsFUVk6NxjgnYTKvrOJNvvTd8