Persistent Volumes - Dynamic prowisioner in AWS

92 views
Skip to first unread message

kape...@gmail.com

unread,
May 21, 2017, 3:41:34 AM5/21/17
to Kubernetes user discussion and Q&A
Hello All,
is it any way to turn dynamic provisioner off in kubernetes? I would like to force kubernetes using PVs which are defined and if it find no one I would like him to drop an error...

Michelle Au

unread,
May 21, 2017, 2:56:46 PM5/21/17
to Kubernetes user discussion and Q&A
You can delete the default storageclass by setting the is-default annotation to false:

On Sun, May 21, 2017 at 12:41 AM, <kape...@gmail.com> wrote:
Hello All,
is it any way to turn dynamic provisioner off in kubernetes? I would like to force kubernetes using PVs which are defined and if it find no one I would like him to drop an error...

--
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+unsubscribe@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.

kape...@gmail.com

unread,
May 21, 2017, 6:09:03 PM5/21/17
to Kubernetes user discussion and Q&A
Actually, no one of my classes is 'default' class:

kubectl get sc

NAME TYPE
default kubernetes.io/aws-ebs
gp2 kubernetes.io/aws-ebs
tk-1a kubernetes.io/aws-ebs
tkvolumes kubernetes.io/aws-ebs

However dynamic provisioning is still working...

> You can delete the default storageclass by setting the is-default annotation to false:
> http://blog.kubernetes.io/2017/03/dynamic-provisioning-and-storage-classes-kubernetes.html
>
>
> On Sun, May 21, 2017 at 12:41 AM, <kape...@gmail.com> wrote:
> Hello All,
>
> is it any way to turn dynamic provisioner off in kubernetes? I would like to force kubernetes using PVs which are defined and if it find no one I would like him to drop an error...
>
>
>
> --
>
> 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-use...@googlegroups.com.
>
> To post to this group, send email to kubernet...@googlegroups.com.

Michelle Au

unread,
May 22, 2017, 1:26:34 PM5/22/17
to Kubernetes user discussion and Q&A
It looks like you have a number of user-installed storage classes.  If you don't want to use storage classes at all, then you should delete all of them.  Otherwise, in your PVC, specify "" as the storageclass name to bind to pre-existing PVs that don't have a storage class.

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

Tomasz Kapek

unread,
May 23, 2017, 2:36:14 AM5/23/17
to Kubernetes user discussion and Q&A
Thank you Michelle, I check the idea not using classes. It sounds like a solution for me ;)

You received this message because you are subscribed to a topic in the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-users/1P21gSLdX58/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-use...@googlegroups.com.

Michelle Au

unread,
May 23, 2017, 6:17:55 PM5/23/17
to Kubernetes user discussion and Q&A
Actually I was mistaken, the other non-default storage classes should not have any impact on your PVCs if you didn't specify any storageclass.  Only the "default" storageclass would have come into effect.  Can you describe the "default" storageclass and see if the "is-default" annotation is set?  You will have to change that to false to disable it.

On Mon, May 22, 2017 at 11:36 PM, Tomasz Kapek <kape...@gmail.com> wrote:
Thank you Michelle, I check the idea not using classes. It sounds like a solution for me ;)

pon., 22 maj 2017, 19:26 użytkownik 'Michelle Au' via Kubernetes user discussion and Q&A <kubernetes-users@googlegroups.com> napisał:
It looks like you have a number of user-installed storage classes.  If you don't want to use storage classes at all, then you should delete all of them.  Otherwise, in your PVC, specify "" as the storageclass name to bind to pre-existing PVs that don't have a storage class.

On Sun, May 21, 2017 at 3:09 PM, <kape...@gmail.com> wrote:
Actually, no one of my classes is 'default' class:

kubectl get sc

NAME        TYPE
default     kubernetes.io/aws-ebs
gp2         kubernetes.io/aws-ebs
tk-1a       kubernetes.io/aws-ebs
tkvolumes   kubernetes.io/aws-ebs

However dynamic provisioning is still working...

> You can delete the default storageclass by setting the is-default annotation to false:
> http://blog.kubernetes.io/2017/03/dynamic-provisioning-and-storage-classes-kubernetes.html
>
>
> On Sun, May 21, 2017 at 12:41 AM,  <kape...@gmail.com> wrote:
> Hello All,
>
> is it any way to turn dynamic provisioner off in kubernetes? I would like to force kubernetes using PVs which are defined and if it find no one I would like him to drop an error...
>
>
>
> --
>
> 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-use...@googlegroups.com.
>
> To post to this group, send email to kubernet...@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+unsubscribe@googlegroups.com.

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

--
You received this message because you are subscribed to a topic in the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-users/1P21gSLdX58/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-users+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.

smal...@gmail.com

unread,
May 24, 2017, 3:00:39 AM5/24/17
to Kubernetes user discussion and Q&A
I have some ideas where the problem can be. I will have access to my k8s when I come back from my trip on Saturday. Then I will go back with detailed storage class description.

kape...@gmail.com

unread,
May 27, 2017, 10:24:42 AM5/27/17
to Kubernetes user discussion and Q&A
Hello Michelle, here is description of all classes I have:

Name: default
IsDefaultClass: No
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storage.k8s.io/v1beta1","kind":"StorageClass","metadata":{"annotations":{},"labels":{"k8s-addon":"storage-aws.addons.k8s.io"},"name":"default","namespace":""},"parameters":{"type":"gp2"},"provisioner":"kubernetes.io/aws-ebs"}

Provisioner: kubernetes.io/aws-ebs
Parameters: type=gp2
Events: <none>


Name: gp2
IsDefaultClass: No
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storage.k8s.io/v1beta1","kind":"StorageClass","metadata":{"annotations":{"storageclass.beta.kubernetes.io/is-default-class":"true"},"labels":{"k8s-addon":"storage-aws.addons.k8s.io"},"name":"gp2","namespace":""},"parameters":{"type":"gp2"},"provisioner":"kubernetes.io/aws-ebs"}
,storageclass.beta.kubernetes.io/is-default-class=false,storageclass.kubernetes.io/is-default-class=false
Provisioner: kubernetes.io/aws-ebs
Parameters: type=gp2
Events: <none>


Name: tk-1a
IsDefaultClass: No
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storage.k8s.io/v1beta1","kind":"StorageClass","metadata":{"annotations":{},"name":"tk-1a","namespace":""},"parameters":{"type":"gp2","zone":"eu-west-1a"},"provisioner":"kubernetes.io/aws-ebs"}
,storageclass.beta.kubernetes.io/is-default-class=false,storageclass.kubernetes.io/is-default-class=false
Provisioner: kubernetes.io/aws-ebs
Parameters: type=gp2,zone=eu-west-1a
Events: <none>


Name: tkvolumes
IsDefaultClass: No
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"storage.k8s.io/v1beta1","kind":"StorageClass","metadata":{"annotations":{},"name":"tkvolumes","namespace":""},"parameters":{"type":"gp2"},"provisioner":"kubernetes.io/aws-ebs"}
,storageclass.beta.kubernetes.io/is-default-class=false,storageclass.kubernetes.io/is-default-class=false
Provisioner: kubernetes.io/aws-ebs
Parameters: type=gp2
Events: <none>

According to documentation "gp2" should be default one, I tried to turn it off using:
kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.beta.kubernetes.io/is-default-class":"false"}}}'

But when I look at the result above I'm not sure it is correct.

kape...@gmail.com

unread,
May 27, 2017, 2:38:12 PM5/27/17
to Kubernetes user discussion and Q&A, kape...@gmail.com
OK, I think I got this now.
If I use storage class in PVClaim kubernetes will try to find existing PV first. If there is no one, then it will be created automatically regardless if selected class is default or not.
Correct me someone if I'm wrong here ;)

Michelle Au

unread,
May 30, 2017, 12:21:46 PM5/30/17
to Kubernetes user discussion and Q&A, kape...@gmail.com
If in your PVC, you:

1. Specify a storage class: Will try to find an existing PV with the same storageclass.  If none exists, it will try to dynamically provision one.
2. Don't specify a storage class: If you have a default storageclass in your cluster, it will dynamically provision one.  Otherwise it will look for PVs with an empty storageclass
3. Specify empty storage class: It will look for PVs with an empty storageclass

It looks like your gp2 storageclass is set to be the default, when you look at the annotations. (I think there is a display bug in kubectl describe that shows the field as false).


Tomasz Kapek

unread,
May 30, 2017, 4:00:35 PM5/30/17
to Kubernetes user discussion and Q&A, kape...@gmail.com
I have removed all storage classes, created a new one and did another research.
Now everything works as I expect.
Thanks for help.


W dniu wtorek, 30 maja 2017 18:21:46 UTC+2 użytkownik Michelle Au napisał:
If in your PVC, you:

1. Specify a storage class: Will try to find an existing PV with the same storageclass.  If none exists, it will try to dynamically provision one.
2. Don't specify a storage class: If you have a default storageclass in your cluster, it will dynamically provision one.  Otherwise it will look for PVs with an empty storageclass
3. Specify empty storage class: It will look for PVs with an empty storageclass

It looks like your gp2 storageclass is set to be the default, when you look at the annotations. (I think there is a display bug in kubectl describe that shows the field as false).

On Sat, May 27, 2017 at 11:38 AM, <kape...@gmail.com> wrote:
OK, I think I got this now.
If I use storage class in PVClaim kubernetes will try to find existing PV first. If there is no one, then it will be created automatically regardless if selected class is default or not.
Correct me someone if I'm wrong here ;)

--
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-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages