Access Redis from EKS

Hello everyone,

I am trying to deploy my micro-services on EKS. My applications are all connected to a Redis instance in charge of queues and caching and the connection fails on Qovery.

When I run my applications locally or on another cloud provider (namely fly.io), I have no issue and the instance is accessible. When deploying on Qovery, my applications throws the following error: “Error: getaddrinfo ENOTFOUND XXX” where XXX is the host of my Redis instance.

I believe the issues has to do with the fact that I deploy on EKS/on kubernetes but I am not sure how to overcome that. Has anyone ever encountered such error ?

Here is the code I use to connect to my instance (NodeJS):

const instance = new Redis({
      host: environment.QUEUE_REDIS_HOST,
      port: environment.QUEUE_REDIS_PORT,
      username: environment.QUEUE_REDIS_USERNAME,
      password: environment.QUEUE_REDIS_PASSWORD,
      family: 6,
      maxRetriesPerRequest: null,
})

Thank you very much if you’re able to help,

Axel

Hi @AxelDeSutter ,

Can you explain how you did create the following environment variables on Qovery:

  • QUEUE_REDIS_HOST
  • QUEUE_REDIS_PORT
  • QUEUE_REDIS_USERNAME
  • QUEUE_REDIS_PASSWORD

Thank you.

Hi Romaric,

I created these environment variables from the console in Cluster > Environment > Service > “New variable” > “Variable”. I then put e.g.:

  • Variable: QUEUE_REDIS_HOST
  • Value: XXX
  • Scope: environment
  • Secret variable: True

Finally I hit “Confirm”.

Important point that I should’ve included in my initial message is that the Redis Instance is running on RedisLabs (so not managed by Qovery) and is configured as “Public”.

Hope this helps !

Hello @AxelDeSutter ,

I can see that you have one managed redis in your “production” environment.
The host that you are targeting in your application is the one managed by Qovery (the hostname written in your application logs corresponds to the QOVERY_REDIS_ZC3047DA3_HOST if you want to check)
Maybe you should update your variable QUEUE_REDIS_HOST to put your desired redis located on RedisLabs

Hello Mevin,

I have indeed created a Managed Instance to try out if that would be working (which is the case) but it is not the instance I am trying to connect to. I don’t want to use a redis instance managed by Qovery for this purpose and would like to connect my applications to my external (RedisLabs) instance, although I am not sue if that is possible.

Thank you for reply !

Are you not trying to access to your RedisLabs instance from your Qovery worker-notifications application ?
The QOVERY_REDIS_XXXX_HOST is the variable that maps the host of your Qovery managed redis

No, the screenshot you posted shows the configuration I tried to see if the issue was related to the instance or to the application. That was only temporary and the redis managed database will be deleted soon.

What I am trying to achieve is connect the application “worker-notifications” to an external (RedisLabs) Redis Instance using the variables QUEUE_REDIS_XXX, which throws an error “ENOTFOUND HOST” where HOST is the correct value.

I believe the error might be that the applications running inside my EKS cluster don’t have access to the external instance hosted on RedisLabs. I could understand why that would be the case but I don’t find source for that restriction online.

If there is no possibility to connect the applications to RedisLabs, then we’ll use a Qovery managed instance.

Ok so if the redis instance is accessible publicly you should be able to connect to it through your Qovery application.
Just tested on my side by creating a free redis instance on redislabs, creating a simple Qovery application and the connection works well.
If your application works locally with your redislabs instance, the issue you encounter can come from the Qovery variables: can you ensure you are mapping them correctly in your application ?

@Melvin_Zottola would you be able to share how you connect to your instance ? Is it in NodeJS by any chance ?

I can’t figure it out and have tried everything I could: it just doesn’t work. Furthermore, I can’t connect to a Qovery Redis database neither so I start wondering if the issue wouldn’t come from the combination of Qovery and the NodeJS “ioredis” package.

It’s not related to .env variable since they are validated in runtime (using zod) and I can see that the application receives exactly the same connection parameters as in local.

If I try a minimal example by creating a sample application with just the following lines, I get the error “ENOTFOUND” although the host provided in the error message is correct.

import { Redis } from "ioredis";

const redis = new Redis(process.env.QOVERY_REDIS_ZXXX_DATABASE_URL, { });

Finally, could it be related to this discussion: Managed Redis env vars use non-SSL protocol ?

I’ve used kotlin using spring boot framework (jvm based), and jedis client to connect to the instance:

        val user = ""
        val password = ""
        val port = 17000
        JedisPool(host, port, user, password).resource.use {
            it.set("REDIS_KEY", "OK")
        }

I don’t know very well NodeJs but if the way you connect works locally, I don’t get why it couldn’t work on Qovery.
Maybe the configuration of your redislabs instance includes ssl or other option that makes the nodejs client failing ? (I have only the free plan on redislabs, don’t see much options on my side)

At this point, I believe this is an issue with ioredis as I managed to connect to my instance using other programming languages or libraries from Qovery.

Thank you for your time and answers @Melvin_Zottola !

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.