Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to kubernetes #1151

Open
meodemsao opened this issue Jun 10, 2020 · 2 comments
Open

Can't connect to kubernetes #1151

meodemsao opened this issue Jun 10, 2020 · 2 comments

Comments

@meodemsao
Copy link

Which chart:
bitnami/redis 6.0.3

Describe the bug
I can't connect to redis
I using ioredis 4.17.1

when i install chart log return

NOTES:
** Please be patient while the chart is being deployed **
Redis can be accessed via port 6379 on the following DNS name from within your cluster:

redis.redis.svc.cluster.local for read only operations

For read/write operations, first access the Redis Sentinel cluster, which is available in port 26379 using the same domain name above.



To connect to your Redis server:

1. Run a Redis pod that you can use as a client:

   kubectl run --namespace redis redis-client --rm --tty -i --restart='Never' \
   --labels="redis-client=true" \
   --image docker.io/bitnami/redis:6.0.3-debian-10-r2 -- bash

2. Connect using the Redis CLI:
   redis-cli -h redis -p 6379 # Read only operations
   redis-cli -h redis -p 26379 # Sentinel access


Note: Since NetworkPolicy is enabled, only pods with label
redis-client=true"
will be able to connect to redis.

My config ios redis

export const cache = new Redis.Cluster(
  [{  
        host: redis.redis.svc.cluster.local,
        port: 26379,
        db: 0,
 }],
  {
    scaleReads: 'slave',
    slotsRefreshTimeout: 2000,
    dnsLookup: (address, callback) => callback(null, address)
  }

output log

[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/app/node_modules/ioredis/built/cluster/index.js:359:31)
    at /app/node_modules/ioredis/built/cluster/index.js:376:21
    at /app/node_modules/ioredis/built/cluster/index.js:624:24
    at run (/app/node_modules/ioredis/built/utils/index.js:156:22)
    at tryCatcher (/app/node_modules/standard-as-callback/built/utils.js:11:23)
    at /app/node_modules/standard-as-callback/built/index.js:30:51
    at runMicrotasks (<anonymous>)
@luin
Copy link
Collaborator

luin commented Jun 16, 2020

There're pretty many reasons that can cause the error. I'd say it seems to be related to network settings. You can enable the debug mode "DEBUG=ioredis:* node yourapp.js" to see if there's any error.

@PuKoren
Copy link

PuKoren commented Aug 20, 2021

i have the same error, in my case it is because redis is not in cluster mode. ioredis will disconnect itself if the master is not in cluster mode

on the latest bitnami helm to deploy a Sentinel cluster, the redis nodes are not in cluster mode.

turned out I had the same issue as the user above because of my code. I also used somehow new Redis.Cluster instead of new Cluster and it caused this error. I think the user might be in the same situation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants