netbox_deploy_v1
Differences
This shows you the differences between two versions of the page.
| netbox_deploy_v1 [2025/07/26 17:09] – - Imported by DokuWiki Advanced Plugin wikiadm | netbox_deploy_v1 [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Netbox Deployment v1 ====== | ||
| - | ===== PostgreSQL ===== | ||
| - | |||
| - | <file bash> | ||
| - | $ helm repo add bitnami https:// | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ helm show values bitnami/ | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ vim postgresql-values.yaml | ||
| - | [...] | ||
| - | 4 global: | ||
| - | [...] | ||
| - | 16 | ||
| - | [...] | ||
| - | 121 auth: | ||
| - | 122 ## @param auth.enablePostgresUser Assign a password to the " | ||
| - | [...] | ||
| - | 130 | ||
| - | 131 ## @param auth.password Password for the custom user to create. Ignored if `auth.existingSecret` with key `password` is provided | ||
| - | [...] | ||
| - | 136 | ||
| - | 137 ## @param auth.replicationUsername Name of the replication user | ||
| - | [...] | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl create ns netbox-community | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ helm install netbox-postgresql --namespace netbox-community bitnami/ | ||
| - | NAME: netbox-postgresql | ||
| - | LAST DEPLOYED: Wed Feb 1 10:23:36 2023 | ||
| - | NAMESPACE: netbox-community | ||
| - | STATUS: deployed | ||
| - | REVISION: 1 | ||
| - | TEST SUITE: None | ||
| - | NOTES: | ||
| - | CHART NAME: postgresql | ||
| - | CHART VERSION: 12.1.10 | ||
| - | APP VERSION: 15.1.0 | ||
| - | |||
| - | ** Please be patient while the chart is being deployed ** | ||
| - | |||
| - | PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster: | ||
| - | |||
| - | netbox-postgresql.netbox-community.svc.cluster.local - Read/Write connection | ||
| - | |||
| - | To get the password for " | ||
| - | |||
| - | export POSTGRES_ADMIN_PASSWORD=$(kubectl get secret --namespace netbox-community netbox-postgresql -o jsonpath=" | ||
| - | |||
| - | To get the password for " | ||
| - | |||
| - | export POSTGRES_PASSWORD=$(kubectl get secret --namespace netbox-community netbox-postgresql -o jsonpath=" | ||
| - | |||
| - | To connect to your database run the following command: | ||
| - | |||
| - | kubectl run netbox-postgresql-client --rm --tty -i --restart=' | ||
| - | --command -- psql --host netbox-postgresql -U netbox -d netbox -p 5432 | ||
| - | |||
| - | > NOTE: If you access the container using bash, make sure that you execute "/ | ||
| - | |||
| - | To connect to your database from outside the cluster execute the following commands: | ||
| - | |||
| - | kubectl port-forward --namespace netbox-community svc/ | ||
| - | PGPASSWORD=" | ||
| - | |||
| - | WARNING: The configured password will be ignored on new installation in case when previous Posgresql release was deleted through the helm command. In that case, old PVC will have an old password, and setting it through helm won't take effect. Deleting persistent volumes (PVs) will solve the issue. | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl get all -n netbox-community | ||
| - | NAME READY | ||
| - | pod/ | ||
| - | |||
| - | NAME | ||
| - | service/ | ||
| - | service/ | ||
| - | |||
| - | NAME | ||
| - | statefulset.apps/ | ||
| - | </ | ||
| - | |||
| - | ===== Redis ===== | ||
| - | <file bash> | ||
| - | $ helm show values bitnami/ | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ vim redis-values.yaml | ||
| - | [...] | ||
| - | 12 global: | ||
| - | [...] | ||
| - | 19 | ||
| - | [...] | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ helm install netbox-redis --namespace netbox-community bitnami/ | ||
| - | NAME: netbox-redis | ||
| - | LAST DEPLOYED: Wed Feb 1 10:32:32 2023 | ||
| - | NAMESPACE: netbox-community | ||
| - | STATUS: deployed | ||
| - | REVISION: 1 | ||
| - | TEST SUITE: None | ||
| - | NOTES: | ||
| - | CHART NAME: redis | ||
| - | CHART VERSION: 17.6.0 | ||
| - | APP VERSION: 7.0.8 | ||
| - | |||
| - | ** Please be patient while the chart is being deployed ** | ||
| - | |||
| - | Redis& | ||
| - | |||
| - | netbox-redis-master.netbox-community.svc.cluster.local for read/write operations (port 6379) | ||
| - | netbox-redis-replicas.netbox-community.svc.cluster.local for read-only operations (port 6379) | ||
| - | |||
| - | |||
| - | |||
| - | To get your password run: | ||
| - | |||
| - | export REDIS_PASSWORD=$(kubectl get secret --namespace netbox-community netbox-redis -o jsonpath=" | ||
| - | |||
| - | To connect to your Redis& | ||
| - | |||
| - | 1. Run a Redis& | ||
| - | |||
| - | | ||
| - | |||
| - | Use the following command to attach to the pod: | ||
| - | |||
| - | | ||
| - | | ||
| - | |||
| - | 2. Connect using the Redis& | ||
| - | | ||
| - | | ||
| - | |||
| - | To connect to your database from outside the cluster execute the following commands: | ||
| - | |||
| - | kubectl port-forward --namespace netbox-community svc/ | ||
| - | REDISCLI_AUTH=" | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl get all -n netbox-community | ||
| - | NAME READY | ||
| - | pod/ | ||
| - | pod/ | ||
| - | pod/ | ||
| - | pod/ | ||
| - | pod/ | ||
| - | |||
| - | NAME TYPE CLUSTER-IP | ||
| - | service/ | ||
| - | service/ | ||
| - | service/ | ||
| - | service/ | ||
| - | service/ | ||
| - | |||
| - | NAME | ||
| - | statefulset.apps/ | ||
| - | statefulset.apps/ | ||
| - | statefulset.apps/ | ||
| - | </ | ||
| - | |||
| - | ===== Netbox ===== | ||
| - | <file yaml netbox-configmap.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: ConfigMap | ||
| - | metadata: | ||
| - | name: netbox-configmap | ||
| - | namespace: netbox-community | ||
| - | data: | ||
| - | ALLOWED_HOSTS: | ||
| - | CHANGELOG_RETENTION: | ||
| - | DB_HOST: netbox-postgresql | ||
| - | DB_NAME: netbox | ||
| - | DB_USER: netbox | ||
| - | EMAIL_FROM: netbox@bar.com | ||
| - | EMAIL_PORT: " | ||
| - | EMAIL_SERVER: | ||
| - | EMAIL_TIMEOUT: | ||
| - | EMAIL_USERNAME: | ||
| - | EXEMPT_VIEW_PERMISSIONS: | ||
| - | LOGIN_REQUIRED: | ||
| - | MEDIA_ROOT: / | ||
| - | METRICS_ENABLED: | ||
| - | NETBOX_USERNAME: | ||
| - | REDIS_HOST: netbox-redis-master | ||
| - | REDIS_CACHE_HOST: | ||
| - | REDIS_PORT: " | ||
| - | REDIS_CACHE_PORT: | ||
| - | REDIS_DATABASE: | ||
| - | REDIS_CACHE_DATABASE: | ||
| - | SUPERUSER_EMAIL: | ||
| - | SUPERUSER_NAME: | ||
| - | MAINTENANCE_MODE: | ||
| - | DEBUG: ' | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f netbox-configmap.yaml | ||
| - | </ | ||
| - | |||
| - | <file yaml netbox-secrets.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: Secret | ||
| - | metadata: | ||
| - | name: netbox-secret | ||
| - | namespace: netbox-community | ||
| - | type: Opaque | ||
| - | data: | ||
| - | email_password: | ||
| - | napalm_password: | ||
| - | secret_key: ISQ5cW1VQDlxaXhQRTZRbiptZnc5NHRPb2xKZGtFYSNlOEY0NTZlMTdOdmlCNXFsbms= | ||
| - | superuser_password: | ||
| - | superuser_api_token: | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f netbox-secrets.yaml | ||
| - | </ | ||
| - | |||
| - | <file yaml netbox-startup-configmap.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: ConfigMap | ||
| - | metadata: | ||
| - | name: startup-configmap | ||
| - | namespace: netbox-community | ||
| - | data: | ||
| - | start-rqworker.sh: | ||
| - | / | ||
| - | |||
| - | nginx-caching-fix.sh: | ||
| - | chown unit:root -R / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f netbox-startup-configmap.yaml | ||
| - | </ | ||
| - | |||
| - | <file yaml netbox-media-pvc.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: PersistentVolumeClaim | ||
| - | metadata: | ||
| - | name: netbox-media-pvc | ||
| - | namespace: netbox-community | ||
| - | labels: | ||
| - | name: netbox-media-pvc | ||
| - | spec: | ||
| - | accessModes: | ||
| - | - ReadWriteMany | ||
| - | resources: | ||
| - | requests: | ||
| - | storage: 1Gi | ||
| - | storageClassName: | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f netbox-media-pvc.yaml | ||
| - | </ | ||
| - | |||
| - | <file yaml netbox-deployment.yaml> | ||
| - | apiVersion: apps/v1 | ||
| - | kind: Deployment | ||
| - | metadata: | ||
| - | name: netbox | ||
| - | namespace: netbox-community | ||
| - | labels: | ||
| - | k8s-app: netbox | ||
| - | spec: | ||
| - | replicas: 3 | ||
| - | selector: | ||
| - | matchLabels: | ||
| - | k8s-app: netbox | ||
| - | template: | ||
| - | metadata: | ||
| - | labels: | ||
| - | k8s-app: netbox | ||
| - | spec: | ||
| - | containers: | ||
| - | # NetBox container using the netbox-docker image: https:// | ||
| - | - name: netbox | ||
| - | image: netboxcommunity/ | ||
| - | ports: | ||
| - | - name: http | ||
| - | containerPort: | ||
| - | readinessProbe: | ||
| - | httpGet: | ||
| - | path: / | ||
| - | port: http | ||
| - | initialDelaySeconds: | ||
| - | periodSeconds: | ||
| - | envFrom: | ||
| - | - configMapRef: | ||
| - | name: netbox-configmap | ||
| - | lifecycle: # Will run the post-startup scripts detailed in netbox-startup-configmap.yaml | ||
| - | postStart: | ||
| - | exec: | ||
| - | command: | ||
| - | - /bin/sh | ||
| - | - -c | ||
| - | - > | ||
| - | bash / | ||
| - | bash / | ||
| - | volumeMounts: | ||
| - | - name: db-password | ||
| - | mountPath: / | ||
| - | subPath: db_password | ||
| - | readOnly: true | ||
| - | - name: email-password | ||
| - | mountPath: / | ||
| - | subPath: email_password | ||
| - | readOnly: true | ||
| - | - name: napalm-password | ||
| - | mountPath: / | ||
| - | subPath: napalm_password | ||
| - | readOnly: true | ||
| - | - name: redis-password | ||
| - | mountPath: / | ||
| - | subPath: redis_password | ||
| - | - name: secret-key | ||
| - | mountPath: / | ||
| - | subPath: secret_key | ||
| - | readOnly: true | ||
| - | - name: superuser-api-token | ||
| - | mountPath: / | ||
| - | subPath: superuser_api_token | ||
| - | - name: superuser-password | ||
| - | mountPath: / | ||
| - | subPath: superuser_password | ||
| - | readOnly: true | ||
| - | # Persistent Volume paths | ||
| - | - name: netbox-media-files # Allows for multiple replicas of the netbox pod to be available | ||
| - | mountPath: / | ||
| - | - mountPath: / | ||
| - | name: start-rqworker | ||
| - | subPath: start-rqworker.sh | ||
| - | - mountPath: / | ||
| - | name: nginx-caching-fix | ||
| - | subPath: nginx-caching-fix.sh | ||
| - | restartPolicy: | ||
| - | volumes: | ||
| - | # Reference to configmaps and PVs | ||
| - | - name: netbox-media-files | ||
| - | persistentVolumeClaim: | ||
| - | claimName: netbox-media-pvc | ||
| - | readOnly: false | ||
| - | - name: start-rqworker | ||
| - | configMap: | ||
| - | name: startup-configmap | ||
| - | items: | ||
| - | - key: " | ||
| - | path: " | ||
| - | - name: nginx-caching-fix | ||
| - | configMap: | ||
| - | name: startup-configmap | ||
| - | items: | ||
| - | - key: " | ||
| - | path: " | ||
| - | # Populate via secret | ||
| - | - name: db-password | ||
| - | secret: | ||
| - | secretName: netbox-postgresql | ||
| - | items: | ||
| - | - key: password | ||
| - | path: db_password | ||
| - | - name: email-password | ||
| - | secret: | ||
| - | secretName: netbox-secret | ||
| - | items: | ||
| - | - key: email_password | ||
| - | path: email_password | ||
| - | - name: napalm-password | ||
| - | secret: | ||
| - | secretName: netbox-secret | ||
| - | items: | ||
| - | - key: napalm_password | ||
| - | path: napalm_password | ||
| - | - name: redis-password | ||
| - | secret: | ||
| - | secretName: netbox-redis | ||
| - | items: | ||
| - | - key: redis-password | ||
| - | path: redis_password | ||
| - | - name: secret-key | ||
| - | secret: | ||
| - | secretName: netbox-secret | ||
| - | items: | ||
| - | - key: secret_key | ||
| - | path: secret_key | ||
| - | - name: superuser-password | ||
| - | secret: | ||
| - | secretName: netbox-secret | ||
| - | items: | ||
| - | - key: superuser_password | ||
| - | path: superuser_password | ||
| - | - name: superuser-api-token | ||
| - | secret: | ||
| - | secretName: netbox-secret | ||
| - | items: | ||
| - | - key: superuser_api_token | ||
| - | path: superuser_api_token | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f netbox-deployment.yaml | ||
| - | </ | ||
| - | |||
| - | <file yaml netbox-service.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: Service | ||
| - | metadata: | ||
| - | name: netbox | ||
| - | namespace: netbox-community | ||
| - | labels: | ||
| - | k8s-app: netbox | ||
| - | spec: | ||
| - | ports: | ||
| - | - port: 80 | ||
| - | targetPort: http | ||
| - | selector: | ||
| - | k8s-app: netbox | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f netbox-service.yaml | ||
| - | </ | ||
netbox_deploy_v1.1753560544.txt.gz · Last modified: by wikiadm
