Skip to main content

Operations

Beta Notice: These Helm charts are currently in beta. While stable for testing and development environments, please thoroughly test in your specific environment before production deployment. For the most up-to-date information, please refer to the main documentation.

Table of Contents

  1. Backup Procedures - Data protection and disaster recovery
  2. Support Bundle Generation - Troubleshooting aid
  3. Maintenance Tasks - System upkeep
  4. Upgrade Procedures - Version management
  5. Scaling - Performance optimization
  6. Next Steps - Continue to troubleshooting

🔧 Operational Commands

Backup & Restore Commands

# Create application data backup
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py dumpdata --output /tmp/netbox-backup.json

# Create database backup (external PostgreSQL)
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
pg_dump -h postgresql-host -U username -d netbox > netbox-backup.sql

# Restore from backup
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py loaddata /tmp/netbox-backup.json

# Copy backup file out of pod
kubectl cp netbox-enterprise/netbox-enterprise-pod:/tmp/netbox-backup.json \
./netbox-backup.json

Scaling Commands

# Scale web pods
kubectl scale deployment netbox-enterprise --replicas=3 -n netbox-enterprise

# Scale worker pods
kubectl scale deployment netbox-enterprise-worker --replicas=2 -n netbox-enterprise

# Check current replica counts
kubectl get deployments -n netbox-enterprise

# Auto-scale based on CPU (requires metrics-server)
kubectl autoscale deployment netbox-enterprise \
--cpu-percent=70 \
--min=2 \
--max=10 \
-n netbox-enterprise

Upgrade Commands

# Check current version
helm list -n netbox-enterprise

# Upgrade to new version
helm upgrade netbox-enterprise \
oci://registry.enterprise.netboxlabs.com/netbox-enterprise/beta/netbox-enterprise \
--values netbox-enterprise-values.yaml \
--values values-extra.yaml \
--version 1.11.4 \
--namespace netbox-enterprise

# Rollback to previous version
helm rollback netbox-enterprise 1 -n netbox-enterprise

# Check upgrade status
helm status netbox-enterprise -n netbox-enterprise

Maintenance Commands

# Database maintenance
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py dbshell -c "VACUUM ANALYZE;"

# Clear application cache
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py shell -c "from django.core.cache import cache; cache.clear()"

# Check database connections
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py dbshell -c "SELECT count(*) FROM pg_stat_activity;"

# Run database migrations
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py migrate

# Collect static files
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py collectstatic --noinput

Resource Monitoring Commands

# Check resource usage
kubectl top pods -n netbox-enterprise
kubectl top nodes

# Check persistent volume usage
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
df -h /opt/netbox/netbox/media

# Monitor resource limits
kubectl describe deployment netbox-enterprise -n netbox-enterprise | grep -A5 "Limits:"

# Check for resource constraints
kubectl get events -n netbox-enterprise --field-selector reason=FailedScheduling

This guide covers ongoing operational procedures for NetBox Enterprise deployments.

Backup Procedures

Proper backup procedures are critical for data protection and disaster recovery.

Database Backup

For production environments, implement regular database backups:

# Create database backup
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py dumpdata --output /tmp/netbox-backup.json

Configuration: For automated backups, see Values Guide - Production Resources for resource requirements.

External Database Backup

If using external PostgreSQL:

# Export database
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
pg_dump -h postgresql-host -U username -d netbox > netbox-backup.sql

Setup: For external database configuration, see Values Guide - External Database Configuration.

Application Data Backups

# Backup media files
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
tar czf /tmp/netbox-media-backup.tar.gz /opt/netbox/netbox/media/

# Copy backup to local machine
kubectl cp netbox-enterprise/netbox-enterprise-pod:/tmp/netbox-media-backup.tar.gz \
./netbox-media-backup.tar.gz

Automated Backup Strategy

For production environments, implement automated backups:

# CronJob for automated backups
apiVersion: batch/v1
kind: CronJob
metadata:
name: netbox-backup
namespace: netbox-enterprise
spec:
schedule: '0 2 * * *' # Daily at 2 AM
jobTemplate:
spec:
template:
spec:
containers:
- name: backup
image: netboxlabs/nbe-utils:7
command:
- /bin/bash
- -c
- |
kubectl exec deployment/netbox-enterprise -- \
python manage.py dumpdata --output /tmp/netbox-backup-$(date +%Y%m%d).json
restartPolicy: OnFailure

Restore Procedures

Application Data Restore

# Restore from backup
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py loaddata /tmp/netbox-backup.json

# Restart deployment after restore
kubectl rollout restart deployment/netbox-enterprise -n netbox-enterprise

Helm Configuration Restore

# Restore Helm configuration
helm upgrade netbox-enterprise netbox/netbox-enterprise \
--values backup-values.yaml \
--namespace netbox-enterprise

Database Restore

For external PostgreSQL:

PGPASSWORD=your-password psql \
-h postgresql-host \
-U username \
-d netbox \
-f netbox-backup.sql

For internal PostgreSQL restore procedures, refer to the NetBox Enterprise restore documentation. This includes:

  • Enabling restore mode
  • Database restore procedures
  • Media, scripts, and reports restoration

Support Bundle Generation

NetBox Enterprise includes built-in support for the troubleshoot.sh framework, providing comprehensive diagnostic information for support cases.

# Install the plugin
curl https://krew.sh/support-bundle | bash

# Generate support bundle
kubectl support-bundle --namespace netbox-enterprise

Prerequisites: Ensure you have the required access as outlined in Prerequisites - Access & Authentication.

This automatically collects:

  • Cluster information and resources
  • NetBox deployment status
  • Application logs (with configurable limits)
  • Database connection status
  • Storage information
  • Network configuration
  • Storage information

Method 2: Using Helm Chart Support Bundle

# Generate support bundle using chart-specific collector
kubectl support-bundle https://raw.githubusercontent.com/netboxlabs/netbox-enterprise-helm/main/support-bundle.yaml

Method 3: Using Replicated Support Bundle

# Generate support bundle using Replicated collector
kubectl support-bundle https://raw.githubusercontent.com/replicatedhq/troubleshoot/main/examples/support-bundle/sample-supportbundle.yaml

Method 4: Manual Collection (Fallback)

If the above methods are unavailable, collect manually:

mkdir netbox-support-bundle
cd netbox-support-bundle

# Collect basic information
kubectl get all -n netbox-enterprise > resources.yaml
kubectl describe all -n netbox-enterprise > descriptions.yaml
kubectl get events -n netbox-enterprise > events.yaml

# Collect logs
kubectl logs -n netbox-enterprise deployment/netbox-enterprise > netbox-logs.txt
kubectl logs -n netbox-enterprise deployment/netbox-enterprise-worker > worker-logs.txt

# Create archive
tar czf netbox-support-bundle-$(date +%Y%m%d-%H%M%S).tar.gz *

Information to Include

When contacting support, include:

  • Helm chart version
  • Kubernetes version and platform
  • Description of the issue
  • Steps to reproduce
  • Recent changes made
  • Support bundle file

Automated Updates

For enterprise users who want to automate NetBox Enterprise updates, several APIs are available for periodic updates via CI/CD systems like GitHub Actions or Jenkins. This ensures you don't miss critical versions with necessary migrations while maintaining control over update timing.

Prerequisites

# Set up authentication variables
export LICENSE_ID="your-license-id-here"
export USERNAME="your-email@company.com"

# Authenticate with registries
docker login proxy.enterprise.netboxlabs.com -u $USERNAME -p $LICENSE_ID
helm registry login registry.enterprise.netboxlabs.com -u $USERNAME -p $LICENSE_ID

Step 1: Get Current Version

# Get current version from your cluster
export CURRENT=$(helm ls --output json | jq -r '.[] | select(.name=="netbox-enterprise") | .app_version')
echo "Current version: $CURRENT"

Step 2: Check for Updates

# Get the latest available version
export VERSION=$(curl \
-H "Authorization: $LICENSE_ID" \
"https://app.enterprise.netboxlabs.com/?current=$CURRENT" \
| jq -r '.label')
echo "Latest version: $VERSION"

Step 3: Download Image List

# Get list of images for the new version
curl \
-o ./images.json \
-H "Authorization: $LICENSE_ID" \
"https://app.enterprise.netboxlabs.com/v3/app/netbox-enterprise/images?version=$VERSION"

Step 4: Update Images (Private Registry Only)

For environments using private registries, update the images:

#!/bin/bash
# Set your private registry
export YOUR_PRIVATE_REGISTRY="your.registry.com"

# Process each image from the API response
jq -r '.[].image' ./images.json | while read -r image; do
# Extract image name and tag
image_name=$(echo "$image" | cut -d':' -f1 | cut -d'/' -f2)
image_tag=$(echo "$image" | cut -d':' -f2)

# Define new tag for your registry
new_image_tag="$YOUR_PRIVATE_REGISTRY/netbox-enterprise/$image_name:$image_tag"

# Pull, tag, and push
docker pull "$image"
docker tag "$image" "$new_image_tag"
docker push "$new_image_tag"
done

Step 5: Update Helm Deployment

Get current values and perform upgrade:

# Backup current values
helm get values netbox-enterprise > netbox-enterprise-values.yaml

# Choose upgrade method based on your environment:

# Method 1: Direct upgrade (online environments)
helm upgrade netbox-enterprise \
oci://registry.enterprise.netboxlabs.com/netbox-enterprise/beta/netbox-enterprise \
--version $VERSION \
--values netbox-enterprise-values.yaml

# Method 2: Offline upgrade (restrictive environments)
helm pull oci://registry.enterprise.netboxlabs.com/netbox-enterprise/beta/netbox-enterprise \
--version $VERSION
helm upgrade netbox-enterprise ./netbox-enterprise-$VERSION.tgz \
--values netbox-enterprise-values.yaml

Automation Script Example

Combine these steps into a script for your CI/CD pipeline:

#!/bin/bash
set -e

# Configuration
LICENSE_ID="your-license-id-here"
USERNAME="your-email@company.com"
NAMESPACE="netbox-enterprise"

# Get current version
CURRENT=$(helm ls -n $NAMESPACE --output json | jq -r '.[] | select(.name=="netbox-enterprise") | .app_version')

# Check for updates
VERSION=$(curl -H "Authorization: $LICENSE_ID" \
"https://app.enterprise.netboxlabs.com/?current=$CURRENT" | jq -r '.label')

if [ "$VERSION" != "$CURRENT" ]; then
echo "Update available: $CURRENT -> $VERSION"

# Backup current values
helm get values netbox-enterprise -n $NAMESPACE > netbox-enterprise-values.yaml

# Upgrade
helm upgrade netbox-enterprise \
oci://registry.enterprise.netboxlabs.com/netbox-enterprise/beta/netbox-enterprise \
--version $VERSION \
--values netbox-enterprise-values.yaml \
--namespace $NAMESPACE

echo "Update completed successfully"
else
echo "No updates available"
fi

Maintenance Tasks

Database Maintenance

Regular database maintenance improves performance:

# Run VACUUM ANALYZE
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- \
python manage.py dbshell -c "VACUUM ANALYZE;"

Performance issues? See Troubleshooting - Database Performance for optimization guidance.

CronJob Utilities

The chart includes maintenance CronJobs:

# Example maintenance CronJob
apiVersion: batch/v1
kind: CronJob
metadata:
name: netbox-maintenance
namespace: netbox-enterprise
spec:
schedule: '0 1 * * 0' # Weekly on Sunday at 1 AM
jobTemplate:
spec:
template:
spec:
containers:
- name: maintenance
image: netboxlabs/nbe-core:latest
command:
- python
- manage.py
- dbshell
- -c
- 'VACUUM ANALYZE;'
restartPolicy: OnFailure

Storage Management

Monitor and manage persistent volume usage:

# Check storage usage
kubectl exec -n netbox-enterprise deployment/netbox-enterprise -- df -h /opt/netbox/netbox/media

Storage setup: Review Prerequisites - Storage Requirements for storage class configuration.

To expand storage:

# Expand PVC (if storage class supports it)
kubectl patch pvc netbox-enterprise-media -n netbox-enterprise \
-p '{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}'

Upgrade Procedures

Version Upgrade

Upgrade to a new version of NetBox Enterprise:

# Check current version
helm list -n netbox-enterprise

# Upgrade to new version
helm upgrade netbox-enterprise \
oci://registry.enterprise.netboxlabs.com/netbox-enterprise/beta/netbox-enterprise \
--values netbox-enterprise-values.yaml \
--values values-extra.yaml \
--version 1.11.4 \
--namespace netbox-enterprise

Rollback Procedures

If an upgrade fails, rollback to the previous version:

# Rollback to previous version
helm rollback netbox-enterprise 1 -n netbox-enterprise

# Check rollback status
helm status netbox-enterprise -n netbox-enterprise

Scaling

NetBox Enterprise can be scaled horizontally to handle increased load.

Manual Scaling

# Scale web pods
kubectl scale deployment netbox-enterprise --replicas=3 -n netbox-enterprise

# Scale worker pods
kubectl scale deployment netbox-enterprise-worker --replicas=2 -n netbox-enterprise

# Check current replica counts
kubectl get deployments -n netbox-enterprise

Auto-scaling

Enable horizontal pod autoscaling:

# Auto-scale based on CPU (requires metrics-server)
kubectl autoscale deployment netbox-enterprise \
--cpu-percent=70 \
--min=2 \
--max=10 \
-n netbox-enterprise

Production Resources: For production scaling recommendations, see Values Guide - Production Resources.

Next Steps

After completing operational procedures, continue with:

  1. Troubleshooting Guide - Resolve common issues
  2. Values Guide - Advanced configuration options
  3. NetBox Enterprise Documentation - Application-specific guides

For performance issues, see Troubleshooting - Performance Issues.

Related Topics