Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wordpress tutorial pvcs #6418

Merged
merged 1 commit into from
Jan 4, 2018
Merged

Conversation

msau42
Copy link
Member

@msau42 msau42 commented Nov 23, 2017

Use the default storageclass instead of pre-provisioned hostpath PVs

Fixes kubernetes/kubernetes#52441


This change is Reviewable

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 23, 2017
@msau42
Copy link
Member Author

msau42 commented Nov 23, 2017

/assign @foxish @saad-ali

@k8sio-netlify-preview-bot
Copy link
Collaborator

k8sio-netlify-preview-bot commented Nov 23, 2017

Deploy preview ready!

Built with commit 0cccf26

https://deploy-preview-6418--kubernetes-io-master-staging.netlify.com

@steveperry-53
Copy link
Contributor

@foxish @saad-ali Can one of you do a tech review for this? Thanks.

@msau42
Copy link
Member Author

msau42 commented Nov 28, 2017

I'm contemplating whether I should actually get rid of the statically created hostpath PVs altogether, and just use the default storageclass to provision the volume. WDYT?

@tengqm
Copy link
Contributor

tengqm commented Nov 28, 2017

@msau42 Avoiding explicit setting of storage class unless you have a good reason,.. is this the encouraged practice?

@msau42
Copy link
Member Author

msau42 commented Nov 28, 2017

sounds good, I'll change it to just use default storage class then. Just wondering if we have any reason to keep the original behavior of using static hostpath PVs, which is now broken.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 28, 2017
@msau42
Copy link
Member Author

msau42 commented Nov 28, 2017

Revamped to use the default storage class. This needs a lot of review. I had to add a lot of text about dynamic provisioning and default storage classes.


### Setting up a hostPath Volume
Many cluster environments have a default StorageClass installed. When a StorageClass is not specified in the PersistentVolumeClaim, the cluster's default StorageClass is used instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick link or note on "how to not use default storage class"? It's not always clear that in order to stop dynamic provisioning sometimes you have to make the SC=""

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is explained in detail in the PVC page.

@@ -7,7 +7,7 @@ approvers:
{% capture overview %}
This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.

A [PersistentVolume](/docs/concepts/storage/persistent-volumes/) (PV) is a piece of storage in the cluster that has been provisioned by an administrator, and a [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) is a set amount of storage in a PV. PersistentVolumes and PersistentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods.
A [PersistentVolume](/docs/concepts/storage/persistent-volumes/) (PV) is a piece of storage in the cluster that has been provisioned by an administrator, and a [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) is a set amount of storage in a PV. PersistentVolumes and PersistentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods. PersistentVolumes can be automatically provisioned by Kubernetes using a [StorageClass](/docs/concepts/storage/storage-classes/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your change. But I feel the explanation of PVC and PV is not very clear.

  1. a PVC is "a set amount of storage in a PV"?
  2. PV is a piece of storage in the cluster has been provisioned by an administrator, or automatically provisioned by Kubernetes using a [StorageClass]?

Copy link
Contributor

@davidz627 davidz627 Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 especially about point 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another possibility:

"PV is a piece of storage in the cluster that has been provisioned (either manually by an administrator, or automatically by Kubernetes using a [StorageClass]). PVC is ..."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. How about now?

@steveperry-53
Copy link
Contributor

This has tech approval from @tengqm. Waiting for resolution of concerns raised by @jingxu97.

@@ -7,7 +7,7 @@ approvers:
{% capture overview %}
This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.

A [PersistentVolume](/docs/concepts/storage/persistent-volumes/) (PV) is a piece of storage in the cluster that has been provisioned by an administrator, and a [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) is a set amount of storage in a PV. PersistentVolumes and PersistentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods.
A [PersistentVolume](/docs/concepts/storage/persistent-volumes/) (PV) is a piece of storage in the cluster that has been provisioned by an administrator, and a [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC) is a set amount of storage in a PV. PersistentVolumes and PersistentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods. PersistentVolumes can be automatically provisioned by Kubernetes using a [StorageClass](/docs/concepts/storage/storage-classes/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another possibility:

"PV is a piece of storage in the cluster that has been provisioned (either manually by an administrator, or automatically by Kubernetes using a [StorageClass]). PVC is ..."

kubectl get pv

The response should be like this:
**Note:** If you are bringing up a cluster that needs to use the `hostPath` provisioner, the `--enable-hostpath-provisioner` flag must be set in the `controller-manager` component.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not trivial to set controller-manager flags. Is this set by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not set by default because hostpath provisioners are only meant for development/local clusters and should not be used in production.

If you use local-up.sh, there is a parameter that you can pass that will set the flag for you. But I'm not sure if we should be prescribing any specific cluster deployment methods in this tutorial.


**Warning:** Only use `hostPath` for developing and testing. With hostPath, your data lives on the node the Pod is scheduled onto and does not move between nodes. If a Pod dies and gets scheduled to another node in the cluster, the data is lost.
**Warning:** In local clusters, the default StorageClass uses the `hostPath` provisioner. `hostPath` volumes are only suitable for development and testing. With `hostPath` volumes, your data lives on the node the Pod is scheduled onto and does not move between nodes. If a Pod dies and gets scheduled to another node in the cluster, the data is lost.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the default hostPath path? It may be a problem if the node filesystem is partially write-protected, but including the path here is good enough IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tmp/hostpath_pv/

hostpath provisioner is only for dev/local clusters, so I don't think we need to worry about node OSes here. If you run this tutorial in GCE, it will use the gce-pd provisioner, and not the hostpath provisioner.

I'll add a note here that the provisioner will create a directory under /tmp, so the data is definitely not in a permanent location.

@jingxu97
Copy link
Contributor

jingxu97 commented Dec 1, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 1, 2017
@msau42
Copy link
Member Author

msau42 commented Dec 12, 2017

@steveperry-53 would you be able to do a docs review?

@msau42
Copy link
Member Author

msau42 commented Jan 2, 2018

ping @steveperry-53 could you find someone to help do a docs review?

@msau42
Copy link
Member Author

msau42 commented Jan 3, 2018

/assign @steveperry-53

@tengqm tengqm merged commit 7d7c5a1 into kubernetes:master Jan 4, 2018
@msau42 msau42 deleted the fix-wordpress-tutorial branch February 9, 2018 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants