GitHub user dosubot[bot] added a comment to the discussion: How to connect to 
external redis db database? Using supersetNode.connections

<!-- Answer -->
Injecting REDIS_PASSWORD via extraEnvFrom makes the variable available in the 
pod, but Superset’s Helm chart only uses the password if you set 
`supersetNode.connections.redis_password` in your values.yaml. The chart does 
not automatically map the REDIS_PASSWORD environment variable to the Redis 
config, so authentication fails even though the variable is present in the pod 
[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/helm/superset/templates/_helpers.tpl).

You have two main options to securely use a password from a Kubernetes secret:

**1. Use configOverrides to read the password from the environment:**

Add your secret as you did, then in your values.yaml, set:

```yaml
configOverrides:
  redis_auth: |
    import os
    REDIS_PASSWORD = os.environ.get("REDIS_PASSWORD")
    CACHE_CONFIG = {
      'CACHE_TYPE': 'RedisCache',
      'CACHE_REDIS_HOST': os.environ.get("REDIS_HOST"),
      'CACHE_REDIS_PORT': os.environ.get("REDIS_PORT"),
      'CACHE_REDIS_DB': os.environ.get("REDIS_DB"),
      'CACHE_REDIS_PASSWORD': REDIS_PASSWORD,
    }
    GLOBAL_ASYNC_QUERIES_CACHE_BACKEND = {
      'CACHE_TYPE': 'RedisCache',
      'CACHE_REDIS_HOST': os.environ.get("REDIS_HOST"),
      'CACHE_REDIS_PORT': os.environ.get("REDIS_PORT"),
      'CACHE_REDIS_DB': os.environ.get("REDIS_DB"),
      'CACHE_REDIS_PASSWORD': REDIS_PASSWORD,
    }
```
This ensures Superset reads the password from the environment and uses it for 
all Redis connections 
[source](https://github.com/apache/superset/discussions/34650).

**2. Use a custom superset_config.py via configFromSecret:**

Create a Kubernetes Secret containing your own superset_config.py with the 
correct Redis settings, then set `configFromSecret` in your values.yaml to the 
name of that secret. This gives you full control, but you must include all 
required settings yourself 
[source](https://github.com/apache/superset/discussions/34861).

After updating your config, redeploy all Superset pods so the new settings take 
effect.

Let me know if you want a more detailed example for either approach!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/a1155a24-b101-4f22-8a27-869504e09f0f?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35496)

GitHub link: 
https://github.com/apache/superset/discussions/35496#discussioncomment-14587772

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to