Re: [kubernetes-users] Re: [google-containers] Can two persistent volume claims be bound to the same persistent volume?

2018-08-24 Thread 'Michelle Au' via Kubernetes user discussion and Q
You can try the nfs-client provisioner to dynamically create subdirectories
on a single NFS server:
https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client

On Fri, Aug 24, 2018 at 9:55 AM 'Tim Hockin' via Kubernetes user discussion
and Q  wrote:

> If you pointed them at the same NFS export (server + path) then it's
> expected that they would see each other's changes.  You can either
> create another export on the server or mount a sub-dir of that export
> (e.g. export /home, but mount /home/you vs /home/me) or you can use
> k8s' `subPath` field on the pods to mount different subdirs.
> On Fri, Aug 24, 2018 at 9:39 AM Stephen Eaton 
> wrote:
> >
> > I tried creating two PV's of 10Gi both pointing at the same NFS of 1TB.
> I also create 2 PVCs for the same StorageClass also of 10Gi.
> >
> > The problem is that when I add a file to on the the PVs the same file is
> present on the other PV.
> >
> > What I would like to be able to do it to create to separate 'partitions'
> (or locaigical separation) so that one PV does not share the data of the
> other PV - is this possible?
> >
> > On Monday, August 1, 2016 at 9:52:41 AM UTC+2, Tim Hockin wrote:
> >>
> >> YOu can create multiple PVs with the same NFS export, as long as that
> >> is acceptable to you :)
> >>
> >> On Mon, Aug 1, 2016 at 12:51 AM, Qian Zhang  wrote:
> >> > Got it, thanks Tim!
> >> >
> >> > BTW, is there any best practice to use PV of NFS type? E.g., there is
> an NFS
> >> > server which has only one export, should admin only create 1 PV for
> it? Or
> >> > it is also OK to create multiple PVs?
> >> >
> >> >
> >> > Thanks,
> >> > Qian Zhang
> >> >
> >> > On Mon, Aug 1, 2016 at 3:32 PM, 'Tim Hockin' via Containers at Google
> >> >  wrote:
> >> >>
> >> >> If your NFS system supports that, that is one way ti could be done,
> yes.
> >> >>
> >> >> On Mon, Aug 1, 2016 at 12:13 AM, Qian Zhang 
> wrote:
> >> >> > I am curious how the storage system behind us does the enforcement,
> >> >> > e.g.,
> >> >> > will we let NFS server know the capacity of PV is 1GB, and NFS
> server
> >> >> > can
> >> >> > guarantee the pod using that PV can not write more than 1GB?
> >> >> >
> >> >> >
> >> >> > Thanks,
> >> >> > Qian Zhang
> >> >> >
> >> >> > On Mon, Aug 1, 2016 at 3:00 PM, 'Tim Hockin' via Containers at
> Google
> >> >> >  wrote:
> >> >> >>
> >> >> >> Nobody enforces it yet (well, WE don't, but the storage system
> behind
> >> >> >> us might).  It's a way to match user needs (PVC) to available
> >> >> >> resources (PV).
> >> >> >>
> >> >> >> > why does user need to define the PVC's capacity when creating
> the
> >> >> >> > PVC?
> >> >> >>
> >> >> >> If the user needs 100GB and I give them a PV with 2 GB, they will
> not
> >> >> >> be happy.  They have to specify how much they nee so we can bind
> (or
> >> >> >> provision) a PV for them.
> >> >> >>
> >> >> >> On Sun, Jul 31, 2016 at 11:54 PM, Qian Zhang 
> >> >> >> wrote:
> >> >> >> > Yeah, actually I am also a bit confused about the capacity user
> >> >> >> > defined
> >> >> >> > in
> >> >> >> > PV and PVC, who will be responsible for enforcing it? E.g., I
> have an
> >> >> >> > NFS
> >> >> >> > server which has 10GB free, and I create a PV (1GB) and PVC
> (1GB),
> >> >> >> > and
> >> >> >> > create a pod uses that PVC. So in the pod, can I only write 1GB
> into
> >> >> >> > the
> >> >> >> > mounted NFS directory? If so, who enforces it?
> >> >> >> >
> >> >> >> > And if a PV can only be used by a single PVC, why does user
> need to
> >> >> >> > define
> >> >> >> > the PVC's capacity when creating the PVC? I think we should not
> ask
> >> >> >> > user
> >> >> >> > to
> >> >> >> > define it, i.e., all the capacity of the PV should be used.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > Thanks,
> >> >> >> > Qian Zhang
> >> >> >> >
> >> >> >> > On Mon, Aug 1, 2016 at 2:45 PM, 'Tim Hockin' via Containers at
> Google
> >> >> >> >  wrote:
> >> >> >> >>
> >> >> >> >> A PV uses a single backing medium, but multiple PVs might
> share that
> >> >> >> >> medium.  Consider "thin" block devices which allocate actual
> space
> >> >> >> >> on
> >> >> >> >> demand.  You might over-commit your storage system.  Consider
> NFS
> >> >> >> >> which can have multiple exports on the same filesystem.  You
> might
> >> >> >> >> over-commit your NFS server.
> >> >> >> >>
> >> >> >> >> Not saying it's a great idea, just that it is possible.
> >> >> >> >>
> >> >> >> >> On Sun, Jul 31, 2016 at 11:40 PM, Qian Zhang <
> zhq5...@gmail.com>
> >> >> >> >> wrote:
> >> >> >> >> > Thanks Tim! So a PV can only be used by a single PVC no
> matter
> >> >> >> >> > what
> >> >> >> >> > its
> >> >> >> >> > type
> >> >> >> >> > is.
> >> >> >> >> >
> >> >> >> >> > And can you please clarify a bit about "You can make a PV
> that
> >> >> >> >> > uses
> >> >> >> >> > the
> >> >> >> >> > same
> >> >> >> >> > backing medium, if the driver allows it"? I do not quite
> >> >> >> >> > understand
> >> >> >> >> > about
> >> >> >> >> > 

Re: [kubernetes-users] Re: [google-containers] Can two persistent volume claims be bound to the same persistent volume?

2018-08-24 Thread 'Tim Hockin' via Kubernetes user discussion and Q
If you pointed them at the same NFS export (server + path) then it's
expected that they would see each other's changes.  You can either
create another export on the server or mount a sub-dir of that export
(e.g. export /home, but mount /home/you vs /home/me) or you can use
k8s' `subPath` field on the pods to mount different subdirs.
On Fri, Aug 24, 2018 at 9:39 AM Stephen Eaton  wrote:
>
> I tried creating two PV's of 10Gi both pointing at the same NFS of 1TB. I 
> also create 2 PVCs for the same StorageClass also of 10Gi.
>
> The problem is that when I add a file to on the the PVs the same file is 
> present on the other PV.
>
> What I would like to be able to do it to create to separate 'partitions' (or 
> locaigical separation) so that one PV does not share the data of the other PV 
> - is this possible?
>
> On Monday, August 1, 2016 at 9:52:41 AM UTC+2, Tim Hockin wrote:
>>
>> YOu can create multiple PVs with the same NFS export, as long as that
>> is acceptable to you :)
>>
>> On Mon, Aug 1, 2016 at 12:51 AM, Qian Zhang  wrote:
>> > Got it, thanks Tim!
>> >
>> > BTW, is there any best practice to use PV of NFS type? E.g., there is an 
>> > NFS
>> > server which has only one export, should admin only create 1 PV for it? Or
>> > it is also OK to create multiple PVs?
>> >
>> >
>> > Thanks,
>> > Qian Zhang
>> >
>> > On Mon, Aug 1, 2016 at 3:32 PM, 'Tim Hockin' via Containers at Google
>> >  wrote:
>> >>
>> >> If your NFS system supports that, that is one way ti could be done, yes.
>> >>
>> >> On Mon, Aug 1, 2016 at 12:13 AM, Qian Zhang  wrote:
>> >> > I am curious how the storage system behind us does the enforcement,
>> >> > e.g.,
>> >> > will we let NFS server know the capacity of PV is 1GB, and NFS server
>> >> > can
>> >> > guarantee the pod using that PV can not write more than 1GB?
>> >> >
>> >> >
>> >> > Thanks,
>> >> > Qian Zhang
>> >> >
>> >> > On Mon, Aug 1, 2016 at 3:00 PM, 'Tim Hockin' via Containers at Google
>> >> >  wrote:
>> >> >>
>> >> >> Nobody enforces it yet (well, WE don't, but the storage system behind
>> >> >> us might).  It's a way to match user needs (PVC) to available
>> >> >> resources (PV).
>> >> >>
>> >> >> > why does user need to define the PVC's capacity when creating the
>> >> >> > PVC?
>> >> >>
>> >> >> If the user needs 100GB and I give them a PV with 2 GB, they will not
>> >> >> be happy.  They have to specify how much they nee so we can bind (or
>> >> >> provision) a PV for them.
>> >> >>
>> >> >> On Sun, Jul 31, 2016 at 11:54 PM, Qian Zhang 
>> >> >> wrote:
>> >> >> > Yeah, actually I am also a bit confused about the capacity user
>> >> >> > defined
>> >> >> > in
>> >> >> > PV and PVC, who will be responsible for enforcing it? E.g., I have an
>> >> >> > NFS
>> >> >> > server which has 10GB free, and I create a PV (1GB) and PVC (1GB),
>> >> >> > and
>> >> >> > create a pod uses that PVC. So in the pod, can I only write 1GB into
>> >> >> > the
>> >> >> > mounted NFS directory? If so, who enforces it?
>> >> >> >
>> >> >> > And if a PV can only be used by a single PVC, why does user need to
>> >> >> > define
>> >> >> > the PVC's capacity when creating the PVC? I think we should not ask
>> >> >> > user
>> >> >> > to
>> >> >> > define it, i.e., all the capacity of the PV should be used.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Qian Zhang
>> >> >> >
>> >> >> > On Mon, Aug 1, 2016 at 2:45 PM, 'Tim Hockin' via Containers at Google
>> >> >> >  wrote:
>> >> >> >>
>> >> >> >> A PV uses a single backing medium, but multiple PVs might share that
>> >> >> >> medium.  Consider "thin" block devices which allocate actual space
>> >> >> >> on
>> >> >> >> demand.  You might over-commit your storage system.  Consider NFS
>> >> >> >> which can have multiple exports on the same filesystem.  You might
>> >> >> >> over-commit your NFS server.
>> >> >> >>
>> >> >> >> Not saying it's a great idea, just that it is possible.
>> >> >> >>
>> >> >> >> On Sun, Jul 31, 2016 at 11:40 PM, Qian Zhang 
>> >> >> >> wrote:
>> >> >> >> > Thanks Tim! So a PV can only be used by a single PVC no matter
>> >> >> >> > what
>> >> >> >> > its
>> >> >> >> > type
>> >> >> >> > is.
>> >> >> >> >
>> >> >> >> > And can you please clarify a bit about "You can make a PV that
>> >> >> >> > uses
>> >> >> >> > the
>> >> >> >> > same
>> >> >> >> > backing medium, if the driver allows it"? I do not quite
>> >> >> >> > understand
>> >> >> >> > about
>> >> >> >> > it, I think a PV should always use a single backing medium rather
>> >> >> >> > than
>> >> >> >> > multiple, right?
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > Thanks,
>> >> >> >> > Qian Zhang
>> >> >> >> >
>> >> >> >> > On Mon, Aug 1, 2016 at 2:34 PM, 'Tim Hockin' via Containers at
>> >> >> >> > Google
>> >> >> >> >  wrote:
>> >> >> >> >>
>> >> >> >> >> A PersistentVolume (PV) is an atomic abstraction.  You can not
>> >> >> >> >> subdivide it across multiple claims.  You can make a PV that uses
>> >> >> >> >> the
>> >> >> >> >> same backing medium, 

[kubernetes-users] Re: [google-containers] Can two persistent volume claims be bound to the same persistent volume?

2018-08-24 Thread Stephen Eaton
I tried creating two PV's of 10Gi both pointing at the same NFS of 1TB. I 
also create 2 PVCs for the same StorageClass also of 10Gi.

The problem is that when I add a file to on the the PVs the same file is 
present on the other PV.

What I would like to be able to do it to create to separate 'partitions' 
(or locaigical separation) so that one PV does not share the data of the 
other PV - is this possible?

On Monday, August 1, 2016 at 9:52:41 AM UTC+2, Tim Hockin wrote:
>
> YOu can create multiple PVs with the same NFS export, as long as that 
> is acceptable to you :) 
>
> On Mon, Aug 1, 2016 at 12:51 AM, Qian Zhang  > wrote: 
> > Got it, thanks Tim! 
> > 
> > BTW, is there any best practice to use PV of NFS type? E.g., there is an 
> NFS 
> > server which has only one export, should admin only create 1 PV for it? 
> Or 
> > it is also OK to create multiple PVs? 
> > 
> > 
> > Thanks, 
> > Qian Zhang 
> > 
> > On Mon, Aug 1, 2016 at 3:32 PM, 'Tim Hockin' via Containers at Google 
> > > wrote: 
> >> 
> >> If your NFS system supports that, that is one way ti could be done, 
> yes. 
> >> 
> >> On Mon, Aug 1, 2016 at 12:13 AM, Qian Zhang  > wrote: 
> >> > I am curious how the storage system behind us does the enforcement, 
> >> > e.g., 
> >> > will we let NFS server know the capacity of PV is 1GB, and NFS server 
> >> > can 
> >> > guarantee the pod using that PV can not write more than 1GB? 
> >> > 
> >> > 
> >> > Thanks, 
> >> > Qian Zhang 
> >> > 
> >> > On Mon, Aug 1, 2016 at 3:00 PM, 'Tim Hockin' via Containers at Google 
> >> > > wrote: 
> >> >> 
> >> >> Nobody enforces it yet (well, WE don't, but the storage system 
> behind 
> >> >> us might).  It's a way to match user needs (PVC) to available 
> >> >> resources (PV). 
> >> >> 
> >> >> > why does user need to define the PVC's capacity when creating the 
> >> >> > PVC? 
> >> >> 
> >> >> If the user needs 100GB and I give them a PV with 2 GB, they will 
> not 
> >> >> be happy.  They have to specify how much they nee so we can bind (or 
> >> >> provision) a PV for them. 
> >> >> 
> >> >> On Sun, Jul 31, 2016 at 11:54 PM, Qian Zhang  > 
> >> >> wrote: 
> >> >> > Yeah, actually I am also a bit confused about the capacity user 
> >> >> > defined 
> >> >> > in 
> >> >> > PV and PVC, who will be responsible for enforcing it? E.g., I have 
> an 
> >> >> > NFS 
> >> >> > server which has 10GB free, and I create a PV (1GB) and PVC (1GB), 
> >> >> > and 
> >> >> > create a pod uses that PVC. So in the pod, can I only write 1GB 
> into 
> >> >> > the 
> >> >> > mounted NFS directory? If so, who enforces it? 
> >> >> > 
> >> >> > And if a PV can only be used by a single PVC, why does user need 
> to 
> >> >> > define 
> >> >> > the PVC's capacity when creating the PVC? I think we should not 
> ask 
> >> >> > user 
> >> >> > to 
> >> >> > define it, i.e., all the capacity of the PV should be used. 
> >> >> > 
> >> >> > 
> >> >> > 
> >> >> > Thanks, 
> >> >> > Qian Zhang 
> >> >> > 
> >> >> > On Mon, Aug 1, 2016 at 2:45 PM, 'Tim Hockin' via Containers at 
> Google 
> >> >> > > wrote: 
> >> >> >> 
> >> >> >> A PV uses a single backing medium, but multiple PVs might share 
> that 
> >> >> >> medium.  Consider "thin" block devices which allocate actual 
> space 
> >> >> >> on 
> >> >> >> demand.  You might over-commit your storage system.  Consider NFS 
> >> >> >> which can have multiple exports on the same filesystem.  You 
> might 
> >> >> >> over-commit your NFS server. 
> >> >> >> 
> >> >> >> Not saying it's a great idea, just that it is possible. 
> >> >> >> 
> >> >> >> On Sun, Jul 31, 2016 at 11:40 PM, Qian Zhang  > 
> >> >> >> wrote: 
> >> >> >> > Thanks Tim! So a PV can only be used by a single PVC no matter 
> >> >> >> > what 
> >> >> >> > its 
> >> >> >> > type 
> >> >> >> > is. 
> >> >> >> > 
> >> >> >> > And can you please clarify a bit about "You can make a PV that 
> >> >> >> > uses 
> >> >> >> > the 
> >> >> >> > same 
> >> >> >> > backing medium, if the driver allows it"? I do not quite 
> >> >> >> > understand 
> >> >> >> > about 
> >> >> >> > it, I think a PV should always use a single backing medium 
> rather 
> >> >> >> > than 
> >> >> >> > multiple, right? 
> >> >> >> > 
> >> >> >> > 
> >> >> >> > Thanks, 
> >> >> >> > Qian Zhang 
> >> >> >> > 
> >> >> >> > On Mon, Aug 1, 2016 at 2:34 PM, 'Tim Hockin' via Containers at 
> >> >> >> > Google 
> >> >> >> > > wrote: 
> >> >> >> >> 
> >> >> >> >> A PersistentVolume (PV) is an atomic abstraction.  You can not 
> >> >> >> >> subdivide it across multiple claims.  You can make a PV that 
> uses 
> >> >> >> >> the 
> >> >> >> >> same backing medium, if the driver allows it.  E.g. consider 
> NFS. 
> >> >> >> >> If 
> >> >> >> >> your NFS server has 150 GB free, nothing stops you from making 
> 2 
> >> >> >> >> PVs 
> >> >> >> >> each of size 100GB.  We can't validate that.  It might be bad 
> for 
> >> >> >> >> your 
> >> >> >> >> users, but that is a decision you have to make as a cluster 
> >> >> >> >>