Search code examples
redisgoogle-cloud-platformgoogle-cloud-memorystore

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?


Solution

  • 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