I'm trying to connect to Google cloud memorystore from kubernetes pod but I always get connection timeout error.
After investigation I found the following:
when I'm trying to connect to redis from pod which scheduled on the normal node pool, it works fine.
but when I'm trying to connect to redis from pod which scheduled on the Preembtiple node pool, it fails and I get connection timeout error.
So how can I solve this problem?
it's a bit hard to give an answer with the little informations you gave, we don't know any configuration of you cluster.
Not sure if I'm totally in the wrong but it may help.
Normal or preemptible node should not have any effect on the network connections if the nodes are on the same network. Whate could cause this on gke pods is that the memorystore works by creating a vpc peering, and that gke works sort of in the same way, thus preventing the memstore and the pods to speak to one another as two peering can't exchange with one another.
What should be done in this case is the use of ip aliasing in the gke creation: https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips
Hope this can help you.