<p>I would run Redis for caching with separate Pod in k8s using <a href="https://github.com/helm/charts/tree/master/stable/redis" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/redis</a> chart.</p>

<p>So redis is managing PVC and using for persistence and in my opinion my application's pod should ideally only need to connect to redis as a service. So, this host:port should be enough as far as I can think..This situation is same as any database.</p>

<p>So my doubt is, should I make any extra configuration in application's yaml for volume which is relates with Redis or PostgreSQL? I mean, should application's pod mount it as well? What is the common usage for following best practices to connect redis or database from application's pod?</p>

<p><strong>i.e parts of configuration in redis for volume</strong></p>

<pre><code>   enabled: true
    path: /data
    subPath: ""
    accessModes:
    - ReadWriteOnce
    size: 8Gi
    matchLabels: {}
    matchExpressions: {}
</code></pre>

<p><strong>Application's deployment.yaml</strong></p>

<pre><code>env:     
      - name: REDIS_HOST
        value: redis-master
      - name: REDIS_PORT
        value: "6379"




- name: POSTGRES_HOST
              valueFrom:
                configMapKeyRef:
                  name: {{ .Release.Name }}-config
                  key: POSTGRES_HOST
            - name: POSTGRES_PORT
              valueFrom:
                configMapKeyRef:
                  name: {{ .Release.Name }}-config
                  key: POSTGRES_PORT
            - name: POSTGRES_DB
              valueFrom:
                configMapKeyRef:
                  name: {{ .Release.Name }}-config
                  key: POSTGRES_DB
</code></pre>

semural
<p>As far as I understand, I think in your case you have to configure PVC/PV. It is properly to setup PVC directly in deployment definition:</p>

<p>Example for redis, creating PVC (only if you have enabled dynamic provisioning): </p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: your-mysql-pv-claim
  labels:
    app: redis
spec:
  storageClassName: your-storage-class
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi
</code></pre>

<p>In Redis deployment configuration file in specification section add following lines:</p>

<pre><code>  volumes:
  - name: your-mysql-persistent-storage
    persistentVolumeClaim:
      claimName: your-mysql-pv-claim
</code></pre>

<p>Same steps you have to fill for postgress. 
Remember ito check if you have storageclass. Otherwise you will have to do it manually. Also remember to define path where specific volume should be mounted. </p>

<p><strong>Storage provisioning in cloud:</strong></p>

<blockquote>
  <p><strong>Static</strong></p>
  
  <p>A cluster administrator creates a number of PVs. They carry the
  details of the real storage, which is available for use by cluster
  users. They exist in the Kubernetes API and are available for
  consumption.</p>
  
  <p><strong>Dynamic</strong></p>
  
  <p>When none of the static PVs the administrator created match a
  user’s PersistentVolumeClaim, the cluster may try to dynamically
  provision a volume specially for the PVC. This provisioning is based
  on StorageClasses: the PVC must request a storage class and the
  administrator must have created and configured that class for dynamic
  provisioning to occur. Claims that request the class "" effectively
  disable dynamic provisioning for themselves.</p>
  
  <p>To enable dynamic storage provisioning based on storage class, the
  cluster administrator needs to enable the DefaultStorageClass
  admission controller on the API server. This can be done, for example,
  by ensuring that DefaultStorageClass is among the comma-delimited,
  ordered list of values for the --enable-admission-plugins flag of the
  API server component. For more information on API server command-line
  flags, check kube-apiserver documentation.</p>
</blockquote>

<p>You can also have <a href="https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/" rel="nofollow noreferrer">shared volumes</a> then two containers can use these volumes to communicate.</p>

<p>More information you can find here: <a href="https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/" rel="nofollow noreferrer">pvc</a>, <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer">pvc-kubernetes</a>, <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/" rel="nofollow noreferrer">pvc-kubernetes-pod</a>.</p>
