Hi,
The "type: DirectoryOrCreate" is support beginning in v1.8 I'm using v1.7.4.
Thanks,CD


Sent from my T-Mobile 4G LTE Device
-------- Original message --------From: David Zhu <d...@google.com> Date: 
3/23/18  6:32 PM  (GMT-06:00) To: kubernetes-users@googlegroups.com, 
dcvtru...@gmail.com Subject: Re: [kubernetes-users] PersistentVolume: path not 
getting created 
Hi CD,
You should be be able to augment your hostPath with a "type" property with 
value "DirectoryOrCreate" to have it create the directory if it does not 
already exist. 
It is documented 
here:https://kubernetes.io/docs/concepts/storage/volumes/#hostpath

Please see the table with various values of the "type" property to see what 
will fit your needs.
Best,David

On Fri, Mar 23, 2018 at 3:22 PM <dcvtru...@gmail.com> wrote:
Hi,



I deploy a persistent volume with a hostPath "path: /tmp/monitoring" the pod 
failed to start with the error message "lstat: /tmp/monitoring No such file or 
Directory".  If /tmp/monitoring is manually created prior to deploying the 
persistent volume then the pod is created and the "subPath: my-db" is mounted 
in /tmp/monitoring/my-db.



Can someone pls tell me what I am doing wrong or missing? I was expecting the 
/tmp/monitoring gets created at the time the container is created.



K8s version: v1.7.4

Cent OS 7.3 64 bit

VM is provision in a vCenter



---

apiVersion: v1

kind: PersistentVolume

metadata:

  name: frontend-0

  namespace: monitoring

  labels:

    app: prom-db

    namespace: my-app

spec:

  capacity:

    storage: 5Gi

  accessModes:

   - ReadWriteOnce

  persistentVolumeReclaimPolicy: Retain

  hostPath:

    path: /tmp/monitoring



Thanks in Advance.



--

You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.

To post to this group, send email to kubernetes-users@googlegroups.com.

Visit this group at https://groups.google.com/group/kubernetes-users.

For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to