Files
Homelabv4/infrastructure/netbird/manifests/api-exporter.yaml
T
2026-03-09 20:21:35 -05:00

105 lines
2.6 KiB
YAML

# Netbird API Exporter - Exposes peer status, groups, users as Prometheus metrics
# Uses the Netbird management API to collect data
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: netbird-api-exporter
namespace: netbird
labels:
app.kubernetes.io/name: netbird-api-exporter
app.kubernetes.io/component: exporter
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: netbird-api-exporter
template:
metadata:
labels:
app.kubernetes.io/name: netbird-api-exporter
app.kubernetes.io/component: exporter
spec:
securityContext:
runAsUser: 10000
runAsGroup: 10000
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: exporter
image: ghcr.io/matanbaruch/netbird-api-exporter:v0.1.46
ports:
- containerPort: 8080
name: metrics
protocol: TCP
env:
- name: NETBIRD_API_URL
value: "http://netbird-management.netbird.svc.cluster.local:80"
- name: NETBIRD_API_TOKEN
valueFrom:
secretKeyRef:
name: netbird-api-token-secret
key: api-token
resources:
limits:
memory: 128Mi
requests:
cpu: 10m
memory: 32Mi
securityContext:
runAsUser: 10000
runAsGroup: 10000
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
livenessProbe:
httpGet:
path: /metrics
port: metrics
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /metrics
port: metrics
initialDelaySeconds: 5
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: netbird-api-exporter
namespace: netbird
labels:
app.kubernetes.io/name: netbird-api-exporter
app.kubernetes.io/component: exporter
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: metrics
protocol: TCP
name: metrics
selector:
app.kubernetes.io/name: netbird-api-exporter
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: netbird-api-exporter
namespace: netbird
labels:
release: kube-prometheus-stack
spec:
selector:
matchLabels:
app.kubernetes.io/name: netbird-api-exporter
endpoints:
- port: metrics
path: /metrics
interval: 30s