<p>I want to store temporary data such as a <strong>json object</strong> and sharable between current pods and any newly created pods in a given kubernetes cluster.</p>

<p>I would like to use this for checkpointing purposes that I would like to share with current pods and any new pods that gets introduced in the cluster. I cannot loose the data for any reason even if all the pods gets deleted by mistake.</p>

<p>If I can isolate this to a specific namespace, that is also helpful.</p>

<p>How can I make a persistent data to store and share across pods?</p>

Kannaiyan
<p>You can use the concept call PV and PVC in kubernetes.</p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: sql-pv-volume
  labels:
    type: local
spec:
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
  persistentVolumeReclaimPolicy: Retain
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sql-pv-claim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
</code></pre>

<p>it will create the pvc in your kubernetes cluster and you can attach it to pods.</p>

<pre><code>volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: sql-pv-claim
</code></pre>

<p>if your pod will goes deleted then also data will be there in PVC</p>
