kentor
kentor

Reputation: 18544

Connecting to redis from kubernetes cluster application

I setup a redis instance (the google managed "memory store") in the same region as I deployed my kubernetes cluster. I expected that I could simply use this private redis ip address as host to connect from an application which is deployed in the kubernetes cluster. Unfortunately I always get etimedout and I have absolutely no idea anymore what I would need to do, to connect to the memory store.

Do I need to add special firewall rules or am I missing something in the process? I haven't setup any custom rules, it's all default.

Upvotes: 2

Views: 1147

Answers (2)

Alexander Vagin
Alexander Vagin

Reputation: 595

In my case it was trouble with network created via terraform. There is no option to ip aliasing. Memorystore should be at your vpc (as peer) and your cluster must be created with ip aliasing, as said in docs. In my case I wrote this:

resource "google_container_cluster" "my-cluster" {
...
  ip_allocation_policy = {
    cluster_ipv4_cidr_block = "10.2.0.0/19"
  }
...
}

And ip aliasing was setted by default. I found this solution here.

Upvotes: 1

Martin Zeitler
Martin Zeitler

Reputation: 76839

most likely you'd have to add a redis tag to the network interface, which permits tcp:6379.

see https://cloud.google.com/community/tutorials/setting-up-redis

in particular, the section "Open the network port (optional)" ...

using Cloud Shell to SSH into such an instance, may help finding the issue.

Upvotes: 0

Related Questions