Home Explore Blog CI



kubernetes

3rd chunk of `content/en/blog/_posts/2016-08-00-Stateful-Applications-Using-Kubernetes-Datera.md`
3293e38b0bbb0bb70cb6a1026b7fd975f5e18f03a5a7a1d10000000100000885
![](https://lh4.googleusercontent.com/ILlUm1HrWhGa8uTt97dQ786Gn20FHFZkavfucz05NHv6moZWiGDG7GlELM6o4CSzANWvZckoAVug5o4jMg17a-PbrfD1FRbDPeUCIc8fKVmVBNUsUPshWanXYkBa3gIJy5BnhLmZ)



**Using Persistent Storage**



Kubernetes PersistentVolumes are used along with a pod using PersistentVolume Claims. Once a claim is defined, it is bound to a PersistentVolume matching the claim’s specification. A typical claim for the PersistentVolume defined above would look like below:




 ```
kind: PersistentVolumeClaim

apiVersion: v1

metadata:

  name: pv-claim-test-petset-0

spec:

  accessModes:

    - ReadWriteOnce

  resources:

    requests:

      storage: 100Gi
  ```



When this claim is defined and it is bound to a PersistentVolume, resources can be used with the pod specification:




 ```
[root@tlx241 /]# kubectl get pv

NAME          CAPACITY   ACCESSMODES   STATUS      CLAIM                            REASON    AGE

pv-datera-0   100Gi      RWO           Bound       default/pv-claim-test-petset-0             6m

pv-datera-1   100Gi      RWO           Bound       default/pv-claim-test-petset-1             6m

pv-datera-2   100Gi      RWO           Available                                              7s

pv-datera-3   100Gi      RWO           Available                                              4s


[root@tlx241 /]# kubectl get pvc

NAME                     STATUS    VOLUME        CAPACITY   ACCESSMODES   AGE

pv-claim-test-petset-0   Bound     pv-datera-0   0                        3m

pv-claim-test-petset-1   Bound     pv-datera-1   0                        3m
  ```



A pod can use a PersistentVolume Claim like below:



 ```
apiVersion: v1

kind: Pod

metadata:

  name: kube-pv-demo

spec:

  containers:

  - name: data-pv-demo

    image: nginx

    volumeMounts:

    - name: test-kube-pv1

      mountPath: /data

    ports:

    - containerPort: 80

  volumes:

  - name: test-kube-pv1

    persistentVolumeClaim:

      claimName: pv-claim-test-petset-0
  ```



The result is a pod using a PersistentVolume Claim as a volume. It in-turn sends the request to the Datera volume plugin to provision storage in the Datera Data Fabric.




 ```

Title: Illustrating PersistentVolumeClaim and Pod Configuration
Summary
This section demonstrates the practical implementation of PersistentVolumeClaims (PVCs) and their integration with Pod specifications in Kubernetes. It provides an example of a PVC configuration (`pv-claim-test-petset-0`) and shows how it binds to a corresponding PersistentVolume (PV). Furthermore, it presents a Pod configuration (`kube-pv-demo`) that utilizes the defined PVC as a volume, enabling the Pod to access the dynamically provisioned storage in the Datera Data Fabric.