netbox-community / netbox-chart

A Helm chart for NetBox
https://netbox.readthedocs.io/
Apache License 2.0
253 stars 153 forks source link

Housekeeping Redis connection error (and perhaps netbox-worker) #381

Open D1StrX opened 22 hours ago

D1StrX commented 22 hours ago

The Helm chart version

netbox-5.0.0-beta.112

Environment Versions

Kubernetes: 1.29
Helm: 3.16.1

Custom chart values

Missing (reusable) values for Housekeeping/Worker :)

*Redis:
  ssl: true
  insecureSkipTlsVerify: false
  caCertPath: <path/to/ca>
...
  existingSecretName: <secret>
  existingSecretKey: <key>

Current Behavior & Steps to Reproduce

Netbox housekeeping cannot connect to Redis node when TLS and/or AUTH is enabled. The chart doesn't contain values to add parameters like caCertPath etc with tasksRedis & cachingRedis.

Does Netbox-worker also connect to Redis? Then it needs to (re)use the values as well.

Expected Behavior

Housekeeping (and netbox-worker if applicable) use the Redis values as connection parameters.

NetBox Logs

🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 29, in _decorator
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 99, in _get
    return self.client.get(key, default=default, version=version, client=client)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/client/default.py", line 260, in get
    raise ConnectionInterrupted(connection=client) from e
django_redis.exceptions.ConnectionInterrupted: Redis ConnectionError: Error 2 connecting to <redis.domain.tld>:6378. No such file or directory.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/extras/management/commands/housekeeping.py", line 20, in handle
    config = Config()
             ^^^^^^^^
  File "/opt/netbox/netbox/netbox/config/__init__.py", line 48, in __init__
    self._populate_from_cache()
  File "/opt/netbox/netbox/netbox/config/__init__.py", line 71, in _populate_from_cache
    self.config = cache.get('config') or {}
                  ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 92, in get
    value = self._get(key, default, version, client)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/cache.py", line 36, in _decorator
    raise e.__cause__
  File "/opt/netbox/venv/lib/python3.12/site-packages/django_redis/client/default.py", line 258, in get
    value = client.get(key)
            ^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/commands/core.py", line 1821, in get
    return self.execute_command("GET", name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/client.py", line 545, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/connection.py", line 1074, in get_connection
    connection.connect()
  File "/opt/netbox/venv/lib/python3.12/site-packages/redis/connection.py", line 283, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 2 connecting to <redis.domain.tld>:6378. No such file or directory.
D1StrX commented 22 hours ago

Figured out that the *Redis values are used globally. When 'caCertPath' is set, it requires to mount the secret/configmap as volumeMount. I think the values should require an example of volumeMounting and a short description that you need to mount it on netbox netbox-worker and housekeeping.