diff --git a/content/rancher/v2.x/en/tasks/clusters/adding-storage/_index.md b/content/rancher/v2.x/en/tasks/clusters/adding-storage/_index.md index 45eff54dcbb..d2a0f7b87c3 100644 --- a/content/rancher/v2.x/en/tasks/clusters/adding-storage/_index.md +++ b/content/rancher/v2.x/en/tasks/clusters/adding-storage/_index.md @@ -4,35 +4,127 @@ weight: 3500 draft: true --- -Rancher allows the user to create Persistent volumes at the cluster level as well as Storage Classes for different cloud provisioners including Amazon EBS and Azure Disks. +Rancher supports two different types of storage for your containers: Persistent Volumes and Storage Classes. -## Adding Persistent Volumes +- [Persistent Volumes](#adding-a-persistent-volume): + + Your Docker containers can store data within themselves, but if a container failes, that data is lost. To solve this issue, Kubernetes offers _persistent volumes_, which is external storage that your container can access. If a container goes down, it can recover data by accessing the persistent volume. Persistent volumes can either be created locally on your nodes, or externally by a vendor, such as Amazon EBS, Azure Disk, and many more. -Rancher support different volume plugins for persistent volumes, including Local Node Disks, Amazon EBS, Azure Disk and many more. +- [Storage Classes](#adding-storage-classes): + + _StorageClasses_ are different categories of storage. For example, you can create different storage classes divide your services into different service level, or you can use them to create a backup storage category. -### Local Node Path Persistent Volume +### Adding a Persistent Volume + +>**Note:** Rancher supports numerous persistent volumes plugins from a variety of different vendors. Therefore, we've written thorough documentation for the most popular plugins, but for plugins that aren't as popular, we wrote a generic procudure that points to external documents that can help. + +#### Adding a Pesistent Volume: Generic Directions + +1. From the **Global** view, open the cluster containing the nodes you want to add persistent volume storage to. + +1. From the main menu, select **Storage > Persistent Volumes**. + +1. Click **Add Volume**. + +1. Enter a **Name** for the persistent volume. + +1. Select a **Volume Plugin**. + +1. Complete the **Plugin Configuration** form. Each plugin type requires information specific to the vendor. For more information about each plugin's form, refer to the reference table below. + +1. Complete the **Customize** form. This form features + + - [Access Modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes): This options sets how many nodes can access the volume, along with the node read/write permissions. The [Kubernettes Documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) includes a table that lists which access modes are supported by the plugins available. + - [Mount Options](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options): Each volume plugin allows you to specify additional command line options during the mounting process. You can enter these options in the **Mount Option** fields. Consult each plugin's documentation for the mount options available. + - [Assign to Storage Class](): + +1. Use the desired **Capacity** for the persistent volume in **Gib**. + +1. Choose the **Path** where this volume will be mounted on the node. + +1. Select From **The Path on the Node must be** drop-down select the type of the host path: + + - AnyThing: do not check the target path + - A directory, or create if doesn't exist + - An existing directory + - An existing file + - An existing socket_ + - An existing character device + - An existing block device + +1. FThe volume can be customized with advanced options including: + + - Access Modes: this option can be one of the following: + - Single Node Read-Write + - Many Nodes Read-Only + - Many Nodes Read-Write -1. From the **Cluster** View select **Storage** > **Persistent Volumes**. -2. Click **Add Volume**. -3. In the **Add Volume** view choose the **Name** of the persistent volume. -4. Select the **Local Node Path** from the **Volume Plugin** drop down. -5. Use the desired **Capacity** for the persistent volume in **Gib**. -6. Choose the **Path** where this volume will be mounted on the node. -7. From **The Path on the Node must be** drop-down select the type of the host path: - - _AnyThing: do not check the target path_ - - _A directory, or create if doesn't exist_ - - _An existing directory_ - - _An existing file_ - - _An existing socket_ - - _An existing character device_ - - _An existing block device_ -8. The volume can be customized with advanced options including: - - **Access Modes:** this option can be one of the following: - - _Single Node Read-Write_ - - _Many Nodes Read-Only_ - - _Many Nodes Read-Write_ - **Mount Options:** this option include any extra mount options for the volume mount. -9. Click **Save** + +1. Click **Save**. + +After clicking **Save** a new persistent volume will be created with the specified name, this volume is a _hostPath_ volume in Kubernetes: +``` +> kubectl get pv + +NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE +test 10Gi RWO Retain Available 23m + +> kubectl get pv/test -o yaml +apiVersion: v1 +kind: PersistentVolume +metadata: + ... +spec: + accessModes: + - ReadWriteOnce + capacity: + storage: 10Gi + hostPath: + path: /tmp/test + type: "" + persistentVolumeReclaimPolicy: Retain +status: + phase: Available +``` + +### Adding a Local Volume + +1. From the **Global** view, open the cluster containing the nodes you want to add persistent volume storage to. + +1. From the main menu, select **Storage > Persistent Volumes**. + +1. Click **Add Volume**. + +1. From **Add Volume**, enter a **Name** for the persistent volume. + +1. Select **Local Node Path** from the **Volume Plugin** drop down. + +1. Use the desired **Capacity** for the persistent volume in **Gib**. + +1. Choose the **Path** where this volume will be mounted on the node. + +1. From **The Path on the Node must be** drop-down select the type of the host path: + + - AnyThing: do not check the target path + - A directory, or create if doesn't exist + - An existing directory + - An existing file + - An existing socket_ + - An existing character device + - An existing block device + +1. The volume can be customized with advanced options including: + + - **Access Modes:** this option can be one of the following: + + - Single Node Read-Write + - Many Nodes Read-Only + - Many Nodes Read-Write + + - **Mount Options:** this option include any extra mount options for the volume mount. + +1. Click **Save**. After clicking **Save** a new persistent volume will be created with the specified name, this volume is a _hostPath_ volume in Kubernetes: ```