Deploy NetBox on RKE2 Using PostgreSQL LXC¶
This HOWTO shows how to deploy NetBox as a workload on the RKE2 cluster while keeping its database on the PostgreSQL LXC (db-01), in line with the principle that Kubernetes is stateless compute and databases live outside the cluster.
It aligns with:
- ADR-0013 – PostgreSQL Runs in LXC (State on Host-Mounted Storage; Backups First-Class)
- ADR-0202 – Adopt RKE2 as Primary Runtime for Platform and Applications
- Evidence 3, which covers NetBox as Source of Truth and its automation story.
1. Objectives¶
By the end of this HOWTO you will be able to:
- Deploy NetBox into an RKE2 namespace using Kubernetes manifests or Helm.
- Configure NetBox to use the existing PostgreSQL LXC as its database.
- Validate NetBox health and basic functionality.
- Capture proof artefacts under
output/artifacts/apps/netbox/.
2. Prerequisites¶
2.1 Platform dependencies¶
You should have:
- A running RKE2 cluster (see HOWTO – Bootstrap an RKE2 Cluster from Proxmox Templates).
- The PostgreSQL LXC (
db-01) provisioned and accessible from the RKE2 worker nodes, with: - NetBox database and user created.
- Network connectivity and firewall rules allowing connections from RKE2 nodes.
2.2 NetBox artefacts¶
- NetBox container image reference (registry and tag).
- Kubernetes manifests or a Helm chart for NetBox that support:
- External database configuration.
- Configuration via environment variables or config files.
2.3 Access and tools¶
kubectlconfigured for the RKE2 cluster.- Access to the Git repo containing NetBox manifests/chart definitions.
- Ability to reach the PostgreSQL LXC from the control node for connectivity tests.
2.4 Related docs¶
3. Prepare NetBox database on PostgreSQL LXC¶
- SSH into the PostgreSQL LXC (
db-01) or use your preferred admin method. - Connect to PostgreSQL:
psql -U postgres
- Create the NetBox database and user (if not already created):
CREATE DATABASE netbox;
CREATE USER netbox_user WITH PASSWORD 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox_user;
- Confirm connectivity from an RKE2 node (for example, using
psqlorncfrom a worker node) to ensure network and firewall are correctly configured.
Record any commands or screenshots in:
4. Configure NetBox manifests or Helm values¶
You may be using:
- A Helm chart for NetBox, or
- Raw Kubernetes manifests.
In both cases, the core settings include:
- Database hostname/IP = address of PostgreSQL LXC (
db-01). - Database name, username and password.
- Any TLS or connection parameters appropriate for your environment.
Example Helm values snippet (illustrative):
netbox:
config:
database:
host: "db-01.internal.local"
name: "netbox"
user: "netbox_user"
passwordSecretName: "netbox-db-credentials"
Create the secret for the database password:
kubectl create secret generic netbox-db-credentials -n network-platform --from-literal=DB_PASSWORD='CHANGE_ME_STRONG_PASSWORD'
Adjust namespace, secret name and key names according to your chart/manifests.
5. Deploy NetBox to RKE2¶
- Choose or create a namespace (for example,
network-platform):
kubectl create ns network-platform
(Skip if it already exists.)
-
Apply Helm chart or manifests:
-
Helm example:
helm upgrade --install netbox ./charts/netbox -n network-platform -f values-netbox-rke2.yaml -
Manifest example:
kubectl apply -n network-platform -f k8s/netbox/ -
Wait for pods to become
Running:
kubectl get pods -n network-platform
- If using an ingress, confirm the associated service and ingress objects exist:
kubectl get svc -n network-platform
kubectl get ingress -n network-platform
6. Validate NetBox functionality¶
- Check pod logs
kubectl logs deploy/netbox -n network-platform
-
Confirm that NetBox started without database connection errors.
-
Port-forward for local testing
kubectl port-forward -n network-platform deploy/netbox 8001:8001
Then open http://localhost:8001/ in your browser.
-
Application-level checks
-
Log in to the NetBox UI.
-
Confirm you can:
- View existing objects (for example, sites, devices) if seed data exists.
- Create a small test object (then delete it if this is a shared environment).
-
Record evidence
-
Copy relevant logs and screenshots to:
-
For example:
kubectl-get-pods-netbox-<date>.txtnetbox-ui-screenshot-<date>.png
7. Wire NetBox into the wider platform story¶
To make NetBox part of the full Evidence 3 and 4 narrative:
-
Ensure automation integrations are enabled
-
For example, Nornir/Ansible jobs that:
- Read from NetBox as Source of Truth.
- Operate on lab or virtual devices.
-
Ensure observability
-
If NetBox exposes metrics or logs, ensure they feed into your Prometheus/Grafana stack.
-
Confirm that outages in NetBox would be visible during DR or platform incidents.
-
Tag NetBox for DR and cost
-
Label the namespace and deployments to reflect:
- Environment (
env=onprem). - Role (
role=source-of-truth).
- Environment (
- This helps tie NetBox into DR workloads and cost modelling (ADR-0701, ADR-0801).
8. Validation checklist¶
- [ ] PostgreSQL LXC (
db-01) hosts thenetboxdatabase and user with appropriate privileges. - [ ] RKE2 cluster is running and reachable with
kubectl. - [ ] NetBox pods in the chosen namespace are
Runningand healthy. - [ ] NetBox can connect to the PostgreSQL LXC without authentication or connectivity errors.
- [ ] Basic NetBox workflows (viewing/creating objects) succeed.
- [ ] Evidence artefacts exist under
output/artifacts/apps/netbox/.
References¶
- ADR-0013 – PostgreSQL Runs in LXC (State on Host-Mounted Storage; Backups First-Class)
- ADR-0202 – Adopt RKE2 as Primary Runtime for Platform and Applications
- Evidence 3 – Source of Truth and Network Automation
- Evidence 4 – Delivery Platform, GitOps and Cluster Operations
output/artifacts/apps/netbox/
Maintainer: HybridOps.Studio
License: MIT-0 for code, CC-BY-4.0 for documentation