diff --git a/content/rancher/v2.x/en/k8s-in-rancher/volumes-and-storage/_index.md b/content/rancher/v2.x/en/k8s-in-rancher/volumes-and-storage/_index.md index d390e2dd108..9e4a90d8fa1 100644 --- a/content/rancher/v2.x/en/k8s-in-rancher/volumes-and-storage/_index.md +++ b/content/rancher/v2.x/en/k8s-in-rancher/volumes-and-storage/_index.md @@ -5,29 +5,28 @@ aliases: - /rancher/v2.x/en/concepts/volumes-and-storage/ - /rancher/v2.x/en/tasks/clusters/adding-storage/ --- -There are two ways to create volumes on Kubernetes: Persistent Volumes (PVs) and Storage Classes. +When deploying an application that needs to retain data, you'll need to create persistent storage. Persistent storage allows you to store application data external from the pod running your application. This storage practice allows you to maintain application data, even if the application's pod fails. + +There are two ways to create persistent storage in Kubernetes: Persistent Volumes (PVs) and Storage Classes. ## Persistent Volumes -_Persistent Volumes_ are pre-provisioned storage volumes that you can bind to specific pods later. For example, in Amazon EC2, you might want to create a number of Elastic Block Store (EBS) volumes before you start running your application. Each pre-provisioned EBS volume corresponds to a Kubernetes persistent volume. When the application starts, it creates Persistent Volume Claims (PVCs) that bind to persistent volumes. A PVC corresponds to a Docker volume. Each PVC binds to one PV that includes the minimum resources that the PVC requires. The following figure illustrates the relationship between pods, PVCs, PVs, and the underlying cloud storage. +_Persistent Volumes_ are pre-provisioned storage volumes that you can bind to pods later. For example, in Amazon EC2, you might want to create a number of Elastic Block Store (EBS) volumes before you start running your application. Each pre-provisioned EBS volume corresponds to a Kubernetes persistent volume. When the application starts, it creates Persistent Volume Claims (PVCs) that bind to persistent volumes. A PVC corresponds to a Docker volume. Each PVC binds to one PV that includes the minimum resources that the PVC requires. The following figure illustrates the relationship between pods, PVCs, PVs, and the underlying cloud storage. ![Persistent Volumes]({{< baseurl >}}/img/rancher/persistent-volume.png) -Rancher allows you to create PVs at cluster level and bind them to PVCs later. Volumes are managed on a per-project basis. +Rancher allows you to create PVs at the cluster level and bind them to PVCs later. Volumes are managed on a per-project basis. ### Adding a Persistent Volume ->**Prerequisites:** -> ->- Working with storage requires the `Manage Volumes` [role]({{< baseurl >}}/rancher/v2.x/en/admin-settings/rbac/cluster-project-roles/#project-role-reference). ->- You must have a storage medium provisioned. For more information, see [Provisioning Storage]({{< baseurl >}}/rancher/v2.x/en/k8s-in-rancher/volumes-and-storage/examples/). - Your containers can store data on themselves, but if a container fails, that data is lost. To solve this issue, Kubernetes offers _persistent volumes_, which are external storage disks or file systems that your containers can access. If a container crashes, its replacement container can access the data in a persistent volume without any data loss. Persistent volumes can either be a disk or file system that you host on premise, or they can be hosted by a vendor, such as Amazon EBS or Azure Disk. ->**Prerequisite:** +>**Prerequisites:** > +>- Working with storage requires the `Manage Volumes` [role]({{< baseurl >}}/rancher/v2.x/en/admin-settings/rbac/cluster-project-roles/#project-role-reference). +>- You must have a storage medium provisioned. For more information, see [Provisioning Storage]({{< baseurl >}}/rancher/v2.x/en/k8s-in-rancher/volumes-and-storage/examples/). >- Create a storage volume either on premise or in the cloud, using one of the vendor services listed in [Types of Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes). >- Gather metadata about your storage volume after you create it. You'll need to enter this information into Rancher. @@ -41,10 +40,10 @@ Persistent volumes can either be a disk or file system that you host on premise, 1. Select the **Volume Plugin** for the disk type or service that you're using. - >**Note:** If the cluster you are adding storage for is a cloud service that also offers cloud storage, you must enable the `cloud provider` option for the cluster, and you must use the service's plug-in to use cloud storage. For example, if you have a Amazon EC2 cluster and you want to use cloud storage for it: - - 1. You must enable the `cloud provider` option for the EC2 cluster. - 2. You must use the `Amazon EBS Disk` volume plugin. + >**Note:** If the cluster you are adding storage for is a cloud service that also offers cloud storage, you must enable the `cloud provider` option for the cluster, and you must use the service's plug-in to use cloud storage. For example, if you have a Amazon EC2 cluster and you want to use cloud storage for it: + > + > - You must enable the `cloud provider` option for the EC2 cluster. + > - You must use the `Amazon EBS Disk` volume plugin. 1. Enter the **Capacity** of your volume in gigabytes. @@ -80,8 +79,9 @@ Storage Classes allow you to create PVCs dynamically without having to create PV Each storage class contains the fields `provisioner`, `parameters`, and `reclaimPolicy`, which are used when a persistent volume that belongs to the class needs to be dynamically provisioned. -The `provisioner` determines which volume plugin is used to provision the persistent volumes. You can define storage classes for the following provisioners: +The `provisioner` determines which volume plugin is used to provision the persistent volumes. +{{% accordion id="provisioners" label="Supported Storage Class Provisioners" %}} - Amazon EBS Disk - AzureFile - AzureDisk @@ -95,6 +95,8 @@ The `provisioner` determines which volume plugin is used to provision the persis - ScaleIO Volume - StorageOS - Vmware vSphere Volume +{{% /accordion %}} +
In addition to customizing each provisioner's options for the storage class, you can also define the volume `reclaimPolicy`. There are two options available: @@ -117,11 +119,10 @@ _Storage Classes_ allow you to dynamically provision persistent volumes on deman 1. From the `Provisioner` drop-down, select the service that you want to use to dynamically provision storage volumes. - >**Note:** If the cluster you are adding a storage class for is a cloud service that also offers cloud storage, you must enable the `cloud provider` option for the cluster, and you must use the service's plug-in to use cloud storage. For example, if you have a Amazon EC2 cluster and you want to use cloud storage for it: - - 1. You must enable the `cloud provider` option for the EC2 cluster. - 2. You must use the `Amazon EBS Disk` provisioner. - + >**Note:** If the cluster you are adding a storage class for is a cloud service that also offers cloud storage, you must enable the `cloud provider` option for the cluster, and you must use the service's plug-in to use cloud storage. For example, if you have a Amazon EC2 cluster and you want to use cloud storage for it: + > + > - You must enable the `cloud provider` option for the EC2 cluster. + > - You must use the `Amazon EBS Disk` provisioner. 1. From the `Parameters` section, fill out the information required for the service to dynamically provision storage volumes. Each provisioner requires different information to dynamically provision storage volumes. Consult the service's documentation for help on how to obtain this information. @@ -138,6 +139,4 @@ You can mount Persistent Volumes in one of two contexts: ## Related Links -### External Docs - -- [Storage](https://kubernetes.io/docs/concepts/storage/) +- [Kubernetes Documentation: Storage](https://kubernetes.io/docs/concepts/storage/)