kubernetescachingrediskubernetes-podredis-cache

Guidance for deploying Redis Cache for Kubernetes Microservices


I am looking to implement Redis Cache for a number of web applications in Kubernetes, but am not sure how exactly to architect the Redis Cache part.

I was thinking that if I have 5 replicas of my application, they could all use a single Redis Cache in a separate pod, as I wanted to avoid using a sidecar container for each application pod. Then for each application, they have their own Redis Cache Deployment in Kubernetes, and the application connects to this (by a service I guess).

Does this sound like a suitable plan? How does the application talk to the Redis Cache pod, do I need to expose it via a Service? I've seen that you should co-locate your Redis Cache and Application on the same node, is this a concern, and is there a way to do this?


Solution

  • With helm you can easily install redis on your cluster using the bitnami chart. Or i prefer to install a redis operator an let it do the magic.

    Either way, you can install one or multiple redis on your kubernetes cluster and they will be accessible through a kubernetes service at something like http://my-redis-service.cool-namespace.svc.cluster.local:6379.

    There is no need to co-host redis on the same node, that's where kubernetes does the work.