Error with redis and node.js

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.15.7
Cloud being used: (aws)
Installation method: kops
Host OS: ubuntu
CNI and version:
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

I have docker images for web (angularjs), api (node.js) , redis. However, i am getting error reaching redis to api (node.js).
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis redis:6379
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

I tried multiple configuration but nothing worked.
const redis = new Redis(‘redis://redis:6379’);
const redis = new Redis({ port: 6379, host: ‘redis’, connectTimeout: 10000 });
const client = redis.createClient(6379,“redis”);

Also, since standard redis image dont have the redis.conf, I added the redis.conf and bind in it, protected-mode yes.
I am still getting the error.

I put all the containers in one deployment i.e, web, api, redis and created the service using type: load balancer. I am able to access the application but i am getting the [ioredis] error.

Any advise will be helpful

Any ideas and suggestion to resolve the redis error. I read many forums, i am not able to resolve this issue.
What is the best deployment strategy? i.e., how the web, api, redis to be distributed in k8s?