Should all pods using a redis cache be constrained to the same node as the rediscache itself?

9/16/2018

We are running one of our services in a newly created kubernetes cluster. Because of that, we have now switched them from the previous "in-memory" cache to a Redis cache.

Preliminary tests on our application which exposes an API shows that we experience timeouts from our applications to the Redis cache. I have no idea why and it issue pops up very irregularly.

So I'm thinking maybe the reason for these timeouts are actually network related. Is it a good idea to put in affinity so we always run the Redis-cache on the same nodes as the application to prevent network issues?

The issues have not arisen during "very high load" situations so it's concerning me a bit.

-- PvPlatten
kubernetes
redis

1 Answer

9/16/2018

This is an opinion question so I'll answer in an opinionated way:

Like you mentioned I would try to put the Redis and application pods on the same node, that would rule out wire networking issues. You can accomplish that with Kubernetes pod affinity. But you can also try nodeslector, that way you always pin your Redis and application pods to a specific node.

Another way to do this is to taint your nodes where you want to run your workloads and then add a toleration to the Redis and your application pods.

Hope it helps!

-- Rico
Source: StackOverflow