<p>I am going to deploy my golang application in multiple pods, and in the other hand deploy multiple redis node each one with its own persistent volume, mean each one has different data, as showing in the below, can you please let me know how I can achieve that with Kubernetes please ? I will have one deployment for the go app with 3 replica since they are stateless that part is easy, but for the redis I will also have another deployment with 3 replica, but how I should let the kuebernetes connect each pod with different PV ?</p>

<pre><code>----------              ----------
| Go-app |  ----------- | Redis-1 |
----------              ----------
                            |__ PV-1

----------              ----------
| Go-app |  ----------- | Redis-2 |
----------              ----------
                            |__ PV-2

----------              ----------
| Go-app |  ----------- | Redis-3 |
----------              ----------
                            |__ PV-3
</code></pre>

Moss
<p>You can install <a href="https://github.com/bitnami/charts/tree/master/bitnami/redis" rel="nofollow noreferrer">bitnami redis helm</a> chart for creating each redis pod with its own persistence storage.You can configure all properties in the helm chart. But in this case the application pod will not be mapped to redis like in the diagram.The chart installs a statefulset redis . You can access the redis node by <code>redis.namespace.svc.cluster.local</code> .</p>

<p>In general its better to seperate your application deployment and redis deployment for scalability and availability .</p>

<p>However your particular use case can be achieved by creating a <a href="https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/" rel="nofollow noreferrer">StatefulSet</a> where both in each pod there will be two containers:</p>

<ol>
<li>Your main application container</li>
<li>Redis container (as a <strong>sidecar</strong>)</li>
</ol>

<p>You can then specify persistent volume for each pod in the StatefulSet Yaml. Here the concept to achieve your case is a Sidecar pattern where supporting containers can be deployed with main container in the same pod.Though it is recommended to create pods containing only one container. In case of requirements where high availability and scalability is required you should run redis as a seperate deployment and not a sidecar.</p>

<p>Hope this helps.</p>
