0

I've got an express service running in a minikube cluster and I'm trying to set up a Redis client, but when I try run the service with the Redis client created it basically stalls on deployment and times out. As soon as I add the line:

const client = redis.createClient('http://127.0.0.1:6379');

My service will not deploy and run (even running the default with no supplied address causes the same issue).

I'm quite new to Kubernetes in general so I'm not sure if this is potentially an issue with minikube? Like trying to create a client from inside the cluster with that address isn't possible or something along those lines..

I'm completely lost with why just trying to create a client is causing this issue so any advice or direction would be greatly appreciated.

SkinnyBetas
  • 461
  • 1
  • 5
  • 27
  • There is a whole networking layer in kubernetes that controls the communication between containers. I would read through the docs here to get the gist of how it works: https://kubernetes.io/docs/concepts/services-networking/ – John Sparwasser Oct 28 '21 at 00:28

1 Answers1

0

Try using "service-name.namespace-name.svc.cluster.local" instead of IP address to connect to service.

For example: If my service name is car-redis-service and namespace is default then the command goes like

redis.createClient(REDISPORT, redis://car-redis-service.default.svc.cluster.local)

Or

redis.createClient(REDISPORT,car-redis-service.default.svc.cluster.local) 

(source)

Here REDISPORT is the port where redis is configured.

For more information on redis in kubernetes refer to this article.

Goli Nikitha
  • 858
  • 3
  • 9