<p>What is the advantage and disadvantage of using <strong>redis</strong> as a sidecar in kubernetes?Is it possible to have persistence cache when redis container is added in each app pod? Will that affect the <strong>availability</strong> and <strong>scalability</strong> of cache?</p>

<p>I'm hard-pressed to think of any advantages to running Redis as a sidecar.  I would always run it as a separate deployment (or stateful set if persistence is enabled) with a separate service.</p>

<p>If Redis is in its own pod then:</p>

<ul>
<li>If your application has multiple replicas, they'll all share the same Redis</li>
<li>When you redeploy your application, it doesn't also terminate and restart Redis</li>
<li>If persistence is enabled for Redis, you don't need to configure your application pods with the persistent storage</li>
</ul>

<p>Given Redis's overall capabilities (principally in-memory storage, limited data-type support), simply storing this cache data in singleton objects in your application would be more or less equivalent to running Redis as a sidecar (one copy of the cache data per pod, data is lost when the pod is deleted).</p>
