netbox

by bootc

Helm chartv4.1.1App v3.2.8Apache-2.0Verified publisher

IP address management (IPAM) and data center infrastructure management (DCIM) tool

About this chart

NetBox

NetBox is an IP address management (IPAM) and data center infrastructure management (DCIM) tool.

TL;DR

$ helm repo add bootc https://charts.boo.tc
$ helm install netbox \
  --set postgresql.postgresqlPostgresPassword=[password1] \
  --set postgresql.postgresqlPassword=[password2] \
  --set redis.auth.password=[password3] \
  bootc/netbox

Prerequisites

  • This chart has only been tested on Kubernetes 1.18+, but should work on 1.14+
  • This chart works with NetBox 3.0.0+ (3.0.11+ recommended)
  • Recent versions of Helm 3 are supported

Installing the Chart

To install the chart with the release name my-release and default configuration:

$ helm repo add bootc https://charts.boo.tc
$ helm install my-release \
  --set postgresql.postgresqlPostgresPassword=[password1] \
  --set postgresql.postgresqlPassword=[password2] \
  --set redis.auth.password=[password3] \
  bootc/netbox

The default configuration includes the required PostgreSQL and Redis database services, but either or both may be managed externally if required.

Production Usage

Always use an existing Secret and supply all passwords and secret keys yourself to avoid Helm re-generating any of them for you.

I strongly recommend setting both postgresql.enabled and redis.enabled to false and using a separate external PostgreSQL and Redis instance. This de-couples those services from the chart's bundled versions which may have complex upgrade requirements. I also recommend using a clustered PostgreSQL server (e.g. using Zalando's Postgres Operator) and Redis with Sentinel (e.g. using Aaron Layfield's redis-ha chart).

Set persistence.enabled to false and use the S3 storageBackend for object storage. This works well with Minio or Ceph RGW as well as Amazon S3.

Run multiple replicas of the NetBox web front-end to avoid interruptions during upgrades or at other times when the pods need to be restarted. There's no need to have multiple workers (worker.replicaCount) for better availability. Set up affinity.podAntiAffinity to avoid multiple NetBox pods being colocated on the same node, for example:

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/instance: netbox
            app.kubernetes.io/name: netbox
            app.kubernetes.io/component: netbox
        topologyKey: kubernetes.io/hostname

Uninstalling the Chart

To delete the chart:

$ helm delete my-release

Upgrading

Bundled PostgreSQL

When upgrading or changing settings and using the bundled Bitnami PostgreSQL sub-chart, you must provide the postgresql.postgresqlPassword at minimum. Ideally you should also supply the postgresql.postgresqlPostgresPassword and, if using replication, the postgresql.replication.password. Please see the upstream documentation for further information.

From 3.x to 4.x

  • NetBox 3.0.0 or above is required
  • The Bitnami Redis sub-chart was upgraded from 12.x to 15.x; please read the upstream upgrade notes if you are using the bundled Redis
  • The cacheTimeout and releaseCheck.timeout settings were removed

From 2.x to 3.x

  • NetBox 2.10.4 or above is required
  • Kubernetes 1.14 or above is required
  • Helm v3 or above is now required
  • The netbox Deployment selectors are changed, so the Deployment must be deleted on upgrades
  • The Bitnami PostgreSQL sub-chart was upgraded from 8.x to 10.x; please read the upstream upgrade notes if you are using the bundled PostgreSQL
  • The Bitnami Redis sub-chart was upgraded from 10.x to 12.x; please read the upstream upgrade notes if you are using the bundled Redis
  • The NGINX container is removed, on account of upstream's migration from Gunicorn to NGINX Unit
  • The webhooksRedis configuration key in values.yaml has been renamed to tasksRedis to match the upstream name
  • The redis_password key in the Secret has been renamed to redis_tasks_password

From 1.x to 2.x

If you use an external Redis you will need to update your configuration values due to the chart reflecting upstream changes in how it uses Redis. There are now separate Redis configuration blocks for webhooks and for caching, though they can both point at the same Redis instance as long as the database numbers are different.

From 0.x to 1.x

The chart dependencies on PostgreSQL and Redis have been upgraded, so you may need to take action depending on how you have configured the chart. The PostgreSQL chart was upgraded from 5.x.x to 7.x.x, and Redis from 8.x.x to 9.x.x.

Configuration

The following table lists the configurable parameters for this chart and their default values.

ParameterDescriptionDefault
replicaCountThe desired number of NetBox pods1
image.repositoryNetBox container image repositorynetboxcommunity/netbox
image.tagNetBox container image tag""
image.pullPolicyNetBox container image pull policyIfNotPresent
superuser.nameInitial super-user account to createadmin
superuser.emailEmail address for the initial super-user account[email protected]
superuser.passwordPassword for the initial super-user accountadmin
superuser.apiTokenAPI token created for the initial super-user account0123456789abcdef0123456789abcdef01234567
skipStartupScriptsSkip [netbox-docker startup scripts]true
allowedHostsList of valid FQDNs for this NetBox instance["*"]
adminsList of admins to email about critical errors[]
authPasswordValidatorsConfigure validation of local user account passwords[]
allowedUrlSchemesURL schemes that are allowed within links in NetBoxsee values.yaml
banner.topBanner text to display at the top of every page""
banner.bottomBanner text to display at the bottom of every page""
banner.loginBanner text to display on the login page""
basePathBase URL path if accessing NetBox within a directory""
changelogRetentionMaximum number of days to retain logged changes (0 = forever)90
customValidatorsCustom validators for NetBox field values{}
defaultUserPreferencesDefault preferences for newly created user accounts{}
cors.originAllowAll[CORS]: allow all originsfalse
cors.originWhitelist[CORS]: list of origins authorised to make cross-site HTTP requests[]
cors.originRegexWhitelist[CORS]: list of regex strings matching authorised origins[]
csrf.cookieNameName of the CSRF authentication cookiecsrftoken
csrf.trustedOriginsA list of trusted origins for unsafe (e.g. POST) requests[]
debugEnable NetBox debugging (NOT for production use)false
dbWaitDebugShow details of errors that occur when applying migrationsfalse
email.serverSMTP server to use to send emailslocalhost
email.portTCP port to connect to the SMTP server on25
email.usernameOptional username for SMTP authentication""
email.passwordPassword for SMTP authentication (see also existingSecret)""
email.useSSLUse SSL when connecting to the serverfalse
email.useTLSUse TLS when connecting to the serverfalse
email.sslCertFileSMTP SSL certificate file path (e.g. in a mounted volume)""
email.sslKeyFileSMTP SSL key file path (e.g. in a mounted volume)""
email.timeoutTimeout for SMTP connections, in seconds10
email.fromSender address for emails sent by NetBox""
enforceGlobalUniqueEnforce unique IP space in the global table (not in a VRF)false
exemptViewPermissionsA list of models to exempt from the enforcement of view permissions[]
fieldChoicesConfigure custom choices for certain built-in fields{}
graphQlEnabledEnable the GraphQL APItrue
httpProxiesHTTP proxies NetBox should use when sending outbound HTTP requestsnull
internalIPsIP addresses recognized as internal to the system['127.0.0.1', '::1']
jobResultRetentionThe number of days to retain job results (scripts and reports)90
loggingCustom Django logging configuration{}
loginPersistenceEnables users to remain authenticated to NetBox indefinitelyfalse
loginRequiredPermit only logged-in users to access NetBoxfalse (unauthenticated read-only access)
loginTimeoutHow often to re-authenticate users1209600 (14 days)
maintenanceModeDisplay a "maintenance mode" banner on every pagefalse
mapsUrlThe URL to use when mapping physical addresses or GPS coordinates`https://maps.goog

Deploy netbox with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has netbox on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnetbox is pinned at v4.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply