How to Limit PV volume Storage In kuberntes at run time growing

2/12/2019

I could not able to limit PV volume on HOST path in kuberntes.

YAML:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ include "go-log.fullname" . }}
  namespace: {{ default "test" .Values.namespace  }}
spec:
  storageClassName: v1
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Mi

apiVersion: v1
kind: LimitRange
metadata:
  name: {{ include "go-log.fullname" . }}
  namespace: {{ default "test" .Values.namespace  }}
spec:
  limits:
  - type: PersistentVolumeClaim
    max:
      storage: 100Mi
    min:
      storage: 20Mi

kind: PersistentVolume
apiVersion: v1
metadata:
  name: {{ include "go-log.fullname" . }}
namespace: {{ default "test" .Values.namespace  }}
labels:
  type: local
spec:
   storageClassName: v1
   persistentVolumeReclaimPolicy: Recycle
capacity:
   storage: 50Mi

accessModes:
  - ReadWriteOnce
hostPath:
    path: {{ default "/home/app_data" .Values.go_pv.path  }}

But I need to limit the pv during Runtime Like(POD should Evit if it crosses certain limit or storage in PV or PVC on HOSTPATH )

I have written go-application which will write log files to mount dir /home/app_data. which i could not control Volume Storage in kubernetes at RUNTIME

-- vikky donekal
google-kubernetes-engine
kubectl
kubernetes

0 Answers