Executive summary & high-level architecture
This server hosts two infrastructure management platforms inside a local Kubernetes cluster:
~/.netbox-port-forward.sh0.0.0.0:8080 → svc/netbox:80~/.dashboard-port-forward.sh0.0.0.0:8443 → svc/kubernetes-dashboard:80mangesh_hardwareTHEONETECH.LABHow Kubernetes (Minikube) operates on this server
What is Minikube?
Unlike a bare-metal multi-node cluster (k3s or kubeadm), Minikube runs the entire Kubernetes cluster inside a single Docker container called minikube (image gcr.io/k8s-minikube/kicbase). That container emulates a full Linux node with its own:
The network layers explained
Because Kubernetes is containerised inside Docker, packets cross several subnets:
| Layer | Subnet | Example |
|---|---|---|
| Physical host network | 192.168.0.0/24 | Host 192.168.0.193 on the office switch |
| Minikube bridge | 192.168.49.0/24 | Bridge br-feecf5216366, node 192.168.49.2 |
| Pod network | 10.244.0.0/16 | NetBox pod 10.244.0.246 |
| Service network | 10.96.0.0/12 | svc/netbox → 10.98.218.25 |
Why can't LAN computers reach cluster IPs directly?
The 10.244.x.x and 10.96.x.x ranges exist only inside Minikube — the office router and laptops know nothing about them. Two mechanisms expose apps on 192.168.0.193:
0.0.0.0 on the host and tunnel into a Service with kubectl port-forward --address 0.0.0.0.30080 for the Hardware app.Deep dive: NetBox deployment
NetBox is the single source of truth for physical and logical network infrastructure, deployed in the netbox namespace via Helm (release netbox, chart netbox-8.3.34, app v4.6.4 on Python 3.12).
The five key workloads
| Component | Resource | Replicas | Purpose |
|---|---|---|---|
| Web frontend | deployment/netbox | 1 | Django app served by Granian (Rust WSGI server). UI and REST/GraphQL APIs on container port 8080. |
| Worker | deployment/netbox-worker | 1 | Django-RQ worker: async tasks, webhooks, cable-path recalculation, scheduled scripts. |
| PostgreSQL | statefulset/netbox-postgresql | 1 | Internal PostgreSQL 16 holding all IPAM, DCIM and tenant data. |
| Valkey | statefulset/netbox-valkey-* | 1 + 3 | Redis-compatible cache and task-queue broker. |
| Housekeeping | cronjob/netbox-housekeeping | Nightly | Runs manage.py housekeeping at midnight to purge expired sessions, tokens and old changelog. |
Persistent storage (PVCs)
data-netbox-postgresql-0(8 GB) — database files at/bitnami/postgresql/datanetbox-media(1 GB) — image attachments, rack diagrams, PDF exportsvalkey-data-netbox-valkey-*(8 GB each) — AOF logs and RDB snapshots
How NetBox reaches the LAN
# service/netbox listens on :80 (ClusterIP 10.98.218.25)
# ~/.netbox-port-forward.sh runs in the background:
kubectl port-forward --address 0.0.0.0 svc/netbox -n netbox 8080:80
LAN URL: http://192.168.0.193:8080
Deep dive: Hardware Asset Inventory
A web app (source in /home/sensei/workspace/Sysadmin-TheOne) that manages hardware lifecycles, user assignments, warranty tracking and invoice attachments. Stack: PHP 8.2 + Apache (php:8.2-apache).
Source code structure
| File | Role |
|---|---|
hardware/index.php | Main frontend and asset dashboard |
hardware/auth.php | LDAP authentication against FreeIPA |
hardware/db.php | PDO PostgreSQL connector |
hardware/api.php | JSON endpoints for CRUD and search |
hardware/uploads/ | Uploaded PDF/JPG invoices |
Kubernetes manifests
k8s/
├── namespace.yaml # isolated 'hardware-inventory' namespace
├── configmap.yaml # non-secret config (DB host/port, LDAP settings)
├── secret.yaml # database password
├── pvc.yaml # 2 GB persistent storage for invoices
├── deployment.yaml # image, health probes and mounts
├── service.yaml # NodePort 30080
└── ingress.yaml # hostname routing for hardware.local
ConfigMap
Injects environment variables so the code never hard-codes IP addresses:
apiVersion: v1
kind: ConfigMap
metadata:
name: hardware-config
namespace: hardware-inventory
data:
DB_HOST: "192.168.0.10"
DB_PORT: "5433"
DB_NAME: "mangesh_hardware"
DB_USER: "mangesh_hardware_user"
LDAP_HOST: "ipa.theonetech.lab"
LDAP_PORT: "389"
LDAP_BASE_DN: "dc=theonetech,dc=lab"
LDAP_REALM: "THEONETECH.LAB"
Secrets: the database password lives in secret.yaml and has been left out of this page on purpose. Keep it out of Git (use Sealed Secrets, SOPS or an external secret store) and rotate it if it was ever committed.
Storage & health checks
/var/www/html/hardware/uploads, so pod updates never delete invoices.GET /index.html every 20 s. If Apache hangs, Kubernetes restarts the container.GET /index.html must pass before the pod receives traffic.Two ways the app can run
hardware-app-deployment-* in hardware-inventory. Reach it at http://192.168.49.2:30080 or via port-forward.hardware-inventory-app bound to host port 8090: http://192.168.0.193:8090.External dependencies & network topology
192.168.0.10, port 5433, DB mangesh_hardware. Stores hardware records, serials, warranty dates, statuses and invoice metadata.ipa.theonetech.lab (fallback 192.168.0.194), port 389, realm THEONETECH.LAB. auth.php authenticates users against company credentials.Network path from a pod to the database
Daily operations & sysadmin runbook
1 · Check general cluster health
minikube status
kubectl get nodes
kubectl get pods -A
Healthy: all pods Running and READY 1/1 (or 3/3 for Valkey).
2 · After a system reboot
Minikube isn't a systemd service by default, so bring everything up manually:
# Step 1: start Minikube
minikube start
# Step 2: start the Hardware Inventory container (Docker Compose)
cd /home/sensei/workspace/Sysadmin-TheOne
docker compose up -d
# Step 3: start the background port forwarders for LAN access
setsid /home/sensei/.netbox-port-forward.sh </dev/null >/dev/null 2>&1 &
setsid /home/sensei/.dashboard-port-forward.sh </dev/null >/dev/null 2>&1 &
Improvement idea: wrap these three steps in a systemd unit (After=docker.service) so the stack starts automatically after a reboot.
3 · View application logs
# NetBox web server
kubectl logs -n netbox -l app.kubernetes.io/name=netbox -c netbox --tail=50 -f
# NetBox worker (background tasks)
kubectl logs -n netbox -l app.kubernetes.io/component=worker --tail=50 -f
# Hardware app — Kubernetes pod
kubectl logs -n hardware-inventory -l app=hardware-app --tail=50 -f
# Hardware app — Docker container
docker logs -f hardware-inventory-app
4 · Open a shell inside a container
# NetBox pod
kubectl exec -it -n netbox deployment/netbox -c netbox -- bash
# Hardware Inventory pod
kubectl exec -it -n hardware-inventory deployment/hardware-app-deployment -- bash
# Test the DB connection from inside the Hardware app pod
php /var/www/html/hardware/test_db.php
5 · Restart an application gracefully
# Zero-downtime rolling restart
kubectl rollout restart deployment netbox -n netbox
kubectl rollout restart deployment hardware-app-deployment -n hardware-inventory
6 · Persistent storage
kubectl get pvc -A
Service & port reference
| Service | Port | Access | Authentication |
|---|---|---|---|
| NetBox Web UI | HTTP 8080 | http://192.168.0.193:8080 | NetBox superuser / DB users |
| Hardware Asset App | HTTP 8090 | http://192.168.0.193:8090 | FreeIPA credentials |
| Hardware App (NodePort) | HTTP 30080 | http://192.168.49.2:30080 | FreeIPA credentials |
| Kubernetes Dashboard | HTTP 8443 | http://192.168.0.193:8443 | Bearer token: kubectl -n kubernetes-dashboard create token kubernetes-dashboard |
| External PostgreSQL | TCP 5433 | 192.168.0.10:5433 | User mangesh_hardware_user |
| FreeIPA LDAP | TCP 389 | 192.168.0.194:389 | Realm THEONETECH.LAB |
Source document: /home/sensei/workspace/INFRASTRUCTURE_ARCHITECTURE_GUIDE.md · Repository: git@github.com:mangesh4694/Sysadmin-TheOne.git