This document contains operational information about the following items used in Konvoy clusters:
- Storage Classes (SC)
- Persistent Volumes (PV)
- Persistent Volume Claims (PVC)
- Container Storage Interface (CSI)
- Storage Addons
Make sure you have reviewed the supporting Introduction to Storage and Introduction to CSI documentation first.
Overview
In Konvoy clusters which are deployed on AWS, Azure or GCP cloud we provide default storage classes using CSI drivers:
For configurations where these drivers are not suitable you must manage your own storage. We recommend the storage solutions of our business partner Portworx. They provide additional Kubernetes storage solutions which may better address your use case.
If you have not enabled or deployed your own [default storage class][default-storage-class] Konvoy provides a rudimentary local storage driver.
Storage with CSI Drivers
Previously we referenced several “drivers” which are in use by default on various cloud platforms when deploying Konvoy. At a high level, and an operational perspective, using these drivers you can automatically manage your Persistent Volumes (PV). The PV is created when a Persistent Volume Claim (PVC) is created on the cluster, and the PV is torn down, depending on the configuration, when the PVCs are deleted.
In the following sections we will discuss some of the basic operational characteristics and capabilities of these drivers and how to utilize them to provision storage for your Kubernetes applications.
Examples
Each of the following example assumes that you have either the AWS, Azure, GCP, Portworx, or Local storage driver deployed to your cluster.
Storage Classes
You can verify that you have a default storage class provided by the driver you’re using by running the following:
In this example a testing cluster was used with the AWS storage driver. The upcoming examples also work the same for Azure, GCP and Portworx.
WARNING: the ReclaimPolicy
has a very direct impact on automated operations for your applications storage. Delete will do exactly what it sounds like it will do if you delete the PVC!
AWS Driver
These examples specifically use the AWS driver and are AWS implementation specific.
Volume Creation
Using storage drivers with Konvoy allows us to abstract away Persistent Volumes some, as we wont need to operationally interact with them under normal circumstances (see our troubleshooting guide for the non-normal circumstances), but instead Persistent Volume Claims become the substrate by which we implement storage for our Kubernetes applications.
In this example we will set up a basic webserver using NGinx with a custom landing page persisted via PVs which are provisioned automatically upon the creation of a PVC. We will follow along with the automated operations for provisioning and mounting created volumes by the driver.
NOTE: Ensure sure you have kubectl
installed and configured to connect to the appropriate Konvoy cluster.
Create the application deployment by running the following:
On success the following output will be received:
If you’re fast you may see the PVC in a pending state:
Very quickly automatic processes from your driver will create a PV and bind it to your PVC:
Now this isn’t magic, the provisioner (a part of the driver) was responsible for creating the necessary PV and binding it to your PVC:
The controller’s csi-provisioner
container above is responsible for making sure the PV gets created, but other containers may be responsible for other components. For example, the ebs-plugin
container is responsible for making the actual EBS API calls to create and mount volumes and attaching the underlying Linux devices:
After a few moments the relevant Deployment
, ReplicaSet
, Pod
and PersistentVolumeClaim
for your webserver should be ready:
At this point our webserver has storage mounted at /usr/share/nginx/html
and can be used going forward, and you can see the PV that was created for it by running:
Volume Deletion
NOTE: These examples assume you followed the above creation example and is written from the perspective of using the AWS Driver.
When using a driver the deletion of the Persistent Volumes is often an implicit side effect of deletion of the Persistent Volume Claim, so treat any operations (manual or automatic) as potential risks for data loss in your production strategies.
Similarly to what was seen in the above documentation on creating volumes, deletion follows the same process:
Under the hood deleting the claim removed the binding to the PV and the driver’s provisioner triggered deletion of the PV:
Critical Operational Considerations
After reviewing the above examples and before you get started on any production deployments ensure you understand whatever storage classes you are implementing with, and note some of the following key considerations that can help you to avoid downtime and datalass in production.
AccessModes
Note from the previous PVC created some of the fields on the record:
Note the accessModes
for your PVC: in this case the AWS driver is in use and is backed by block storage which has the characteristic of requiring ReadWriteOnce
mode (RWO).
ReadWriteOnce
PVCs can not be shared between multiple pods for high availability, and also can pose some fault tolerance concerns related to uptime: if the Kubernetes node where a PVC is bound to a pod gets disconnected from the rest of the cluster, the driver may not be able to automatically reschedule the pod to another node and re-connect the storage quickly to avoid multiple pods writing to the same block device and rendering it corrupted (some of this is driver specific as some drivers may react different to netsplits, but consider this a good rule of thumb to prepare for).