Two containers within same pod on Kubernetes

7/25/2018

I have a microservice that needs to build a cache on a Redis server upon initialization, fetching data from a MongoDB instance outside the cluster.

Is it a bad practice to put the service and the Redis server in two separate containers on the same pod? Or should they be on different pods?

-- Pedro Henrique
kubernetes

1 Answer

7/25/2018

They should be on different pods (and different deployments).

Two reasons for this: you probably want to share a single Redis cache across multiple copies of the service (their scaling properties are different); and you can deploy a prebuilt Redis system (via Helm) without needing to tightly integrate it with your application deployment.

-- David Maze
Source: StackOverflow