Continental Innovates with Rancher and Kubernetes
This section describes how to provision new persistent storage for workloads in Rancher.
This section assumes that you understand the Kubernetes concepts of storage classes and persistent volume claims. For more information, refer to the section on how storage works.
New storage is often provisioned by a cloud provider such as Amazon EBS. However, new storage doesn’t have to be in the cloud.
If you have a pool of block storage, and you don’t want to use a cloud provider, Longhorn could help you provide persistent storage to your Kubernetes cluster. For more information, see this page.
To provision new storage for your workloads, follow these steps:
The following storage provisioners are enabled by default:
To use a storage provisioner that is not on the above list, you will need to use a feature flag to enable unsupported storage drivers.
These steps describe how to set up a storage class at the cluster level.
Go to the cluster for which you want to dynamically provision persistent storage volumes.
From the cluster view, select Storage > Storage Classes. Click Add Class.
Storage > Storage Classes
Enter a Name for your storage class.
From the Provisioner drop-down, select the service that you want to use to dynamically provision storage volumes. For example, if you have a Amazon EC2 cluster and you want to use cloud storage for it, use the Amazon EBS Disk provisioner.
Amazon EBS Disk
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.
Result: The storage class is available to be consumed by a PVC.
For full information about the storage class parameters, refer to the official Kubernetes documentation..
These steps describe how to set up a PVC in the namespace where your stateful workload will be deployed.
Go to the project containing a workload that you want to add a PVC to.
From the main navigation bar, choose Resources > Workloads. (In versions prior to v2.3.0, choose Workloads on the main navigation bar.) Then select the Volumes tab. Click Add Volume.
Enter a Name for the volume claim.
Select the Namespace of the volume claim.
In the Source field, click Use a Storage Class to provision a new persistent volume.
Go to the Storage Class drop-down and select the storage class that you created.
Enter a volume Capacity.
Optional: Expand the Customize section and select the Access Modes that you want to use.
Result: Your PVC is created. You can now attach it to any workload in the project.
Mount PVCs to workloads so that your applications can store their data.
You can mount PVCs during the deployment of a workload, or following workload creation.
To attach the PVC to a new workload,
Result: When the workload is deployed, it will make a request for the specified amount of disk space to the Kubernetes master. If a PV with the specified resources is available when the workload is deployed, the Kubernetes master will bind the PV to the PVC.
To attach the PVC to an existing workload,
Result: The workload will make a request for the specified amount of disk space to the Kubernetes master. If a PV with the specified resources is available when the workload is deployed, the Kubernetes master will bind the PV to the PVC. If not, Rancher will provision new persistent storage.