atkayla
atkayla

Reputation: 8839

Unable to connect to MemoryStore instance (GKE, Node.js)

My Redis host is '10.0.0.x', port is 6379, and I made sure my k8s cluster which hosts Node.js pods and MemoryStore are in the same region, but it still times out when trying to connect.

var Redis = require('ioredis');
var redis = new Redis({
    port: 6379,          // Redis port
    host: '10.0.0.x',   // Redis host
})
redis.on('connect', () => console.log('connected'))

Am I missing a step?

Upvotes: 2

Views: 1935

Answers (2)

Gopal
Gopal

Reputation: 151

Closing the loop on this. The need for IP alias is documented here https://cloud.google.com/memorystore/docs/redis/connecting-redis-instance

IP alias makes Pod IP addresses are natively routable within the GCP network including peered networks. https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips

Upvotes: 0

atkayla
atkayla

Reputation: 8839

I had to enable VPC Native Alias IP in the Kubernetes Engine dashboard.

enter image description here

https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips

Upvotes: 4

Related Questions