-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Conversation
Deploy preview ready! Built with commit 0cccf26 https://deploy-preview-6418--kubernetes-io-master-staging.netlify.com |
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? |
@msau42 Avoiding explicit setting of storage class unless you have a good reason,.. is this the encouraged practice? |
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. |
f00a25f
to
f134d91
Compare
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. |
There was a problem hiding this comment.
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=""
There was a problem hiding this comment.
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/). |
There was a problem hiding this comment.
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.
- a PVC is "a set amount of storage in a PV"?
- PV is a piece of storage in the cluster has been provisioned by an administrator, or automatically provisioned by Kubernetes using a [StorageClass]?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. How about now?
@@ -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/). |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
f134d91
to
0cccf26
Compare
/lgtm |
@steveperry-53 would you be able to do a docs review? |
ping @steveperry-53 could you find someone to help do a docs review? |
/assign @steveperry-53 |
Use the default storageclass instead of pre-provisioned hostpath PVs
Fixes kubernetes/kubernetes#52441
This change is