Kubernetes Deployment Persistent Volume and VM disk size

7/16/2019

After creating a NFS Persistent Volume for one of Deployments running in a cluster the containers are able to store and share the file data between each other. The file data is persistent between the containers life cycles too. And that's great! But I wonder where exactly is this file data stored: where is it "physically" located? Is it saved onto the container itself or is it saved somewhere onto a VM's disk - the VM that is used to run the Deployment?

The VM that is used to host the Deployment has only 20 Gb available disk space by default. Let's say I am running a Docker container inside a pod on a Node (aka VM) running some file server. What happens if I attempt to transfer a 100 Gb file to that File Server? Where will be this gigantic file saved if the VM disk itself has only 20 Gb available space?

Edited later by appending the portion of yaml file:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-claim
  labels:
    app: deployment
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
# ---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment
spec:
  selector:
    matchLabels:
      app: app
  replicas: 1
  minReadySeconds: 10
  strategy:
    type: RollingUpdate # Recreate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
      - name: container
        image: 12345.dkr.ecr.us-west-2.amazonaws.com/container:v001      
        ports:
        - containerPort: 80
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: volume-mount
          mountPath: /data      
      volumes:
      - name: volume-mount
        persistentVolumeClaim:
          claimName: pv-claim
-- alphanumeric
amazon-web-services
eks
kubernetes

2 Answers

7/16/2019

In your case the data is stored on NFS share. Connect to NFS server and browse through the shares and find the share that is mounted to the pod.

-- P Ekambaram
Source: StackOverflow

7/16/2019

The "physical" location of the volume is defined by the provisioner, which is defined by the storage class. Your PV claim doesn't have a storage class assigned. That means that the default storage class is used, and it can be anything. I suspect that in EKS default storage class will be EBS, but you should double check that.

First, see what storage class is actually assigned to your persistent volumes:

kubectl get pv -o wide

Then see what provisioner is assigned to that storage class:

kubectl get storageclass

Most likely you will see something like kubernetes.io/aws-ebs. Then google documentation for a specific provisioner to understand where the volume is stored "physically".

-- Sergey Kovalev
Source: StackOverflow