SPC based cStor Guide
Deprecation Notice
cStor out-of-tree external
provisioners will be deprecated by Dec 2021 in favor of the corresponding CSI Drivers. The out of tree provisioners for cStor will stop working from Kubernetes 1.22 and forward as the version of the custom resources used by those provisioners will be deprecated. We strongly recommend you plan for migrating your volumes to cStor CSI as early as possible.
For detailed instructions on how to get started with new cStor Operators please refer here.
If you have any questions or need help with the migration please reach out to us on our Kubernetes Community slack channel #openebs
This user guide section provides the operations need to performed by the User and the Admin for configuring cStor related tasks.
#
User operationsSnapshot and Clone of a cStor Volume
Upgrading the software version of a cStor volume
Provisioning sample application with cStor
Patching pool deployment by adding or modifying resource limit and requests
#
Admin operationsCreating cStor storage classes
Upgrade the software version of a cStor pool
Expanding cStor pool to a new node
Expanding size of a cStor pool instance on a node by expanding the size of cloud disks
Expanding size of a cStor pool instance on a node by add physical/virtual disks to a pool instance
Expanding the cStor Volume Capacity
Scaling up cStor Volume Replica
Scaling down cStor Volume Replica
#
User Operations#
Provisioning a cStor volumeFor provisioning a cStor Volume, it requires a cStor Storage Pool and a StorageClass. The configuration and verification of a cStor Storage pool can be checked from here. The configuration and verification of a StorageClass can be checked from here.
Use a similar PVC spec or volumeClaimTemplate to use a StorageClass that is pointing to a pool with real disks. Consider the following parameters while provisioning OpenEBS volumes on real disks.
AccessModes: cStor provides iSCSI targets, which are appropriate for RWO (ReadWriteOnce) access mode and is suitable for all types of databases. For webscale applications like WordPress or any for any other NFS needs, you need RWM (ReadWriteMany) access mode. For RWM, you need NFS provisioner to be deployed along with cStor. See how to provision RWM PVC with OpenEBS
Size: cStor supports thin provisioning by default, which means you can request any size of the volume through the PVC and get it provisioned. Resize of the volume is not fully supported through the OpenEBS control plane in the current release and it is under active development, see roadmap for more details. Hence it is recommended to give good amount of buffer to the required size of the volume so that you don't need to resize immediately or in a very short time period.
The following shows the example PVC configuration for a Deployment and a StatefulSet application which uses a configured StorageClass to provision a cStor Volume. The provided StorageClass should have been configured with StoragePoolClaim property, so the cStor Volume will be provisioned on the StoragePools associated to the StoragePoolClaim.
#
Example configuration for requesting OpenEBS volume for a Deployment#
Example configuration for requesting OpenEBS volume for a StatefulSet#
Monitoring a cStor VolumeBy default the VolumeMonitor
is set to ON in the cStor StorageClass. Volume metrics are exported when this parameter is set to ON. Following metrics are supported by cStor as of the current release.
Grafana charts can be built for the above Prometheus metrics.
#
Snapshot and Clone of a cStor VolumeAn OpenEBS snapshot is a set of reference markers for data at a particular point in time. A snapshot act as a detailed table of contents, with accessible copies of data that user can roll back to the required point of instance. Snapshots in OpenEBS are instantaneous and are managed through kubectl
.
During the installation of OpenEBS, a snapshot-controller and a snapshot-provisioner are setup which assist in taking the snapshots. During the snapshot creation, snapshot-controller creates VolumeSnapshot
and VolumeSnapshotData
custom resources. A snapshot-provisioner is used to restore a snapshot as a new Persistent Volume(PV) via dynamic provisioning.
In this section the steps for the creation, clone and deletion a snapshot is provided.
#
Creating a cStor SnapshotThe following steps will help you to create a snapshot of a cStor volume. For creating the snapshot, you need to create a YAML specification and provide the required PVC name into it. The only prerequisite check is to be performed is to ensure that there is no stale entries of snapshot and snapshot data before creating a new snapshot.
Copy the following YAML specification into a file called snapshot.yaml.
Edit the snapshot.yaml which is created in previous step to update
name
:- Name of snapshot which is going to createnamespace
:- Namespace of source PVCpersistentVolumeClaimName
:- Source PVC which you are going to take the snapshot.
Run the following command to create the snapshot of the provided PVC.
The above command creates a snapshot of the cStor volume and two new CRDs. To list the snapshots, use the following command
Note: All cStor snapshots should be created in the same namespace of source PVC.
#
Cloning a cStor SnapshotOnce the snapshot is created, restoration from a snapshot or cloning the snapshot is done through a two step process. First create a PVC that refers to the snapshot and then use the PVC to create a new PV. This PVC must refer to a storage class called openebs-snapshot-promoter
.
Copy the following YAML specification into a file called snapshot_claim.yaml.
Edit the YAML file to update
name
:- Name of the clone PVCnamespace
:- Same namespace of source PVC- The annotation
snapshot.alpha.kubernetes.io/snapshot
:- Name of the snapshot storage
:- The size of the volume being cloned or restored. This should be same as source PVC.
Note: Size and namespace should be same as the original PVC from which the snapshot was created.
Run the following command to create a cloned PVC.
Get the details of newly created PVC for the snapshot.
Mount the above PVC in an application YAML to browse the data from the clone.
Note: For deleting the corresponding source volume, it is mandatory to delete the associated clone volumes of this source volume. The source volume deletion will fail if any associated clone volume is present on the cluster.
#
Deleting a cStor SnapshotDelete the snapshot using the kubectl command by providing the the same YAML specification that was used to create the snapshot.
This will not affect any PersistentVolumeClaims
or PersistentVolumes
that were already provisioned using the snapshot. On the other hand, deleting any PersistentVolumeClaims
or PersistentVolumes
that were provisioned using the snapshot will not delete the snapshot from the OpenEBS backend.
#
Backup and RestoreOpenEBS volume can be backed up and restored along with the application using OpenEBS velero plugin. It helps the user for backing up the OpenEBS volumes to third party storage location and restore the data whenever it is required. The steps for taking backup and restore are as follows.
#
Prerequisites- Latest tested Velero version is 1.4.0.
- Create required storage provider configuration to store the backup.
- Create required OpenEBS storage pools and storage classes on destination cluster.
- Add a common label to all the resources associated to the application that you want to backup. For example, add an application label selector in associated components such as PVC,SVC etc.
#
Install Velero (Formerly known as ARK)Follow the instructions at Velero documentation to install and configure Velero.
#
Steps for BackupVelero is a utility to back up and restore your Kubernetes resource and persistent volumes.
To do backup/restore of OpenEBS cStor volumes through Velero utility, you need to install and configure OpenEBS velero-plugin. OpenEBS velero-plugin can be installed using the below command:
Above command will install the latest OpenEBS velero-plugin image.
If you are using OpenEBS velero-plugin then velero backup
command invokes velero-plugin internally and takes a snapshot of cStor volume data and send it to remote storage location as mentioned in 06-volumesnapshotlocation.yaml
. The configuration of 06-volumesnapshotlocation.yaml
can be done in the next section.
#
Configure Volumesnapshot LocationTo take a backup of cStor volume through Velero, configure VolumeSnapshotLocation
with provider openebs.io/cstor-blockstore
. Sample YAML file for volumesnapshotlocation can be found at 06-volumesnapshotlocation.yaml
from the openebs/velero-plugin
repo.
Sample spec for configuring volume snapshot location.
The following are the definition for each parameters.
- name : Provide a snapshot location name. Eg: gcp-default
- bucket : Provide the bucket name created on the cloud provider. Eg: gcpbucket
- prefix : Prefix for backup name. Eg: cstor
- backupPathPrefix: Prefix for backup path. Eg: newbackup. This should be same as
prefix
mentioned in05-backupstoragelocation.yaml
for keeping all backups at same path. For more details , please refer here. - namespace : (Optional) Provide the namespace where OpenEBS is installed. OpenEBS velero plugin will automatically take the OpenEBS installed namespace in the absence of this parameter.
- Provider : Provider name. Eg: gcp or aws
- region : Provide region name if cloud provider is AWS or use
minio
if it is a MinIO bucket.
For configuring parameters for AWS
or MinIO
in volumesnapshotlocation
, refer here for more details.
Example for GCP configuration:
After creating the 06-volumesnapshotlocation.yaml
with the necessary details, apply the YAML using the following command.
Currently supported volumesnapshotlocations
for velero-plugin are AWS, GCP and MinIO.
#
Managing BackupsTake the backup using the below command. Here, you need to get the label of the application.
Note: SNAPSHOT_LOCATION
should be the same as you configured in the 06-volumesnapshotlocation.yaml
. You can use --selector
as a flag in backup command to filter specific resources or use a combo of --include-namespaces
and --exclude-resources
to exclude specific resources in the specified namespace. More details can be read from here.
Example:
The above command shown in example will take backup of all resources which has a common label app=minio
.
After taking backup, verify if backup is taken successfully by using following command.
The following is a sample output.
From the example mentioned in configure-volumesnapshotlocation, backup files of cStor volumes will be stored at gcpbucket/newbackup/backups/new1/cstor-<pv_name>-new1
You will get more details about the backup using the following command.
Example:
Once the backup is completed you should see the Phase
marked as Completed
and Persistent Volumes
field shows the number of successful snapshots.
#
Steps for RestoreVelero backup can be restored onto a new cluster or to the same cluster. An OpenEBS PVC with the same name as the original PVC will be created and application will run using the restored OpenEBS volume.
Prerequisites
- Create the same namespace and StorageClass configuration of the source PVC in your target cluster.
- If the restoration happens on same cluster where Source PVC was created, then ensure that application and its corresponding components such as Service, PVC,PV and cStorVolumeReplicas are deleted successfully.
On the target cluster, restore the application using the below command.
Example:
The restoration job details can be obtained using the following command.
Once the restore job is completed you should see the corresponding restore job is marked as Completed
.
Note: After restoring, you need to set targetip
for the volume in all pool pods. This means, if there are 3 cStor pools of same SPC, then you need to set targetip
for the volume in all the 3 pool pods. Target IP of the PVC can be find from running the following command.
Output will be similar to the following
In this case, 10.4.43.221
is the service IP of the PV. This target ip is required after login to the pool pod. The steps for updating target ip is as follows:
After entering the cstor-pool
container, get the dataset name from the output of following command.
Update the targetip
for the corresponding dataset using the following command.
After executing the above command, exit from the container session. The above procedure has to be performed on all the other cStor pools of the same SPC.
Verify application status using the following command. Now the application should be running.
Verify PVC status using the following command.
#
Scheduling backupsUsing velero schedule
command, periodic backups are taken.
In case of velero-plugin, this periodic backups are incremental backups which saves storage space and backup time. To restore periodic backup with velero-plugin, refer here for more details. The following command will schedule the backup as per the cron time mentioned .
Note: SNAPSHOT_LOCATION
should be the same as you configured by using 06-volumesnapshotlocation.yaml
Get the details of backup using the following command
During the first backup iteration of a schedule, full data of the volume will be backed up. After taking the full backup in the first schedule, then it will take the incremental backup as part of the next iteration.
#
Restore from a Scheduled BackupSince the backups taken are incremental for a schedule, order of restoring data is important. You need to restore data in the order of the backups created.
For example, below are the available backups for a schedule.
Restoration of data need to be done in following way:
#
Deletion of BackupsTo delete a single backup which is not created from scheduled backup, use the following command.
Note: the deletion of backup will not delete the snapshots created as part of backup from the cStor Storage pool. This can be deleted by following manual steps .
First verify the cStor backups created for corresponding cStor volume. To obtain the cStor backups of cStor volume, use the following command by providing the corresponding backup name.
Delete the corresponding cStor backups using the following command.
To delete the cStor backup completed jobs, use the following command.
The deletion of Velero backup schedule doesn't destroy the backup created during the schedule. User need to delete a scheduled backup manually. Use the above steps to delete the scheduled backups.
#
Troubleshooting guide for Backup and RestoreBackup having status as
FailedValidation
.
If you don’t provide --storage-location
during backup then velero will use default
backupstoragelocation. You can either create a new backupstoragelocation named default
or specify default backupstoragelocation in velero server command line using --default-backup-storage-location
.
- Failed to take backup
This error happens when cStor volume doesn’t have sufficient healthy replicas to create a snapshot.
To check the replica status:
- Backup PartiallyFailed
If all the CVRs are healthy and snapshot creation is successful then check for the following logs in velero backup logs <BACKUP_NAME>
Above is a known issue with velero-plugin having version <= 1.8.0-velero_1.0.0.
- Debugging Restore
When Velero finishes a Restore, it's status changes to Completed
regardless of whether or not there are issues during the process. The number of warnings and errors are indicated in the output columns from velero restore get
command:
To delve into the warnings and errors in more detail, you can use velero restore describe
command:
The output looks like this:
Errors usually appear for incomplete or partial restores. Warnings appear for non-blocking issues (e.g. the restore looks "normal" and all resources referenced in the backup exist in some form, although some of them may have been pre-existing).
Both errors and warnings are structured in the same way:
Velero: A list of system-related issues encountered by the Velero server (e.g. couldn't read directory).
Cluster: A list of issues related to the restore of cluster-scoped resources.
Namespaces: A map of namespaces to the list of issues related to the restore of their respective resources.
Some general commands for troubleshooting:
velero backup describe <backupName>
- describe the details of a backupvelero backup describe <backupName> --details
- describe the details of a backup and snapshot of persistent volumesvelero backup logs <backupName>
- fetch the logs for this specific backup. Useful for viewing failures and warnings, including resources that could not be backed up.velero restore describe <restoreName>
- describe the details of a restorevelero restore logs <restoreName>
- fetch the logs for this specific restore. Useful for viewing failures and warnings, including resources that could not be restored.kubectl logs deployment/velero -n velero
- fetch the logs of the velero server pod. This provides the output of the Velero server processes.
You can increase the verbosity of velero server logging by editing Velero deployment file using the command kubectl edit deployment/velero -n velero
The Snippet of deployment YAML file looks as below:
#
Upgrading the software version of a cStor volumeThe steps are mentioned in Upgrade section. For upgrading cStorVolume, ensure that cStor Pool image is support this cStor volume image. It should also recommended to upgrade the corresponding pool before upgrading cStor volume. The steps for upgrading the cStor volume can be find from here.
#
Provisioning sample application with cStorBefore provisioning an application ensure that all the below mentioned steps are carried out:
Ensure that the filesystem is mounted as per requirement. To know more about mount status click here.
Create StoragePool specifying the Blockdevices that are to be used. To know the detailed steps for creation of StoragePool click here. The name specified under metadata in the StoragePoolClaim YAML needs to be mentioned in StorageClass YAML (in the next step). Using this StoragePool create StorageClass by referring here.
Once all the above actions have been successfully executed, You can deploy Busybox with cStor volume as follows: Copy the below spec into a file, say demo-busybox-cstor.yaml and update storageClassName to openebs-sc-statefulset.
Now execute the above yaml file using the below-mentioned command
To verify whether the application is successfully deployed, execute the following command
The application pods should be running as displayed below:
To verify whether the target pod is successfully deployed, execute the following command
The target pod should be running as displayed below:
The resiliency of the application upon different undesired conditions such as forced reschedule, container crashes or slow network connectivity to cstor target pods can be verified by the following chaos experiments: OpenEBS target pod failure OpenEBS target (istgt) container failure OpenEBS target network delay
#
Deleting a cStor VolumeThe cStor volume can be deleted by deleting the corresponding PVC. This can be done by using the following command.
The successful deletion of a cStor volume can be verified by running the following commands and ensure there is no entries of particular volume exists as part of the output.
Verify the PVC is deleted successfully using the following command.
Verify the PV is deleted successfully using the following command:
Verify if the cStorVolume is deleted successfully using the following command:
Verify if the cStorVolumeReplica(CVR) is deleted successfully using the following command:
Verify corresponding cStor Volume target also deleted successfully using the following command:
#
Patching pool deployment by adding or modifying resource limit and requestsCreate a patch file called "patch.yaml" and add the following content to it. You can change the values based on the Node configuration. Recommended values are 4Gi for limits and 2Gi for requests.
Get the pool deployment using the following command:
Patch the corresponding pool deployment using the following command.
Eg:
Note: After patching, the existing pool pod will be terminated and a new pool pod will be created. Repeat the same process for other deployments of the same pool as well one by one once new pool pod is created.
#
Admin Operations#
Creating cStor Storage PoolsThe cStorStoragePool can be created by specifying the blockDeviceList. The following section will describe the steps in detail.
#
Create a cStorPool by specifying blockDeviceListOverview
- Get the details of blockdevices attached in the cluster.
- Create a StoragePoolClaim configuration YAML and update the required details.
- Apply the StoragePoolClaim configuration YAML to create the cStorStoragePool.
Step1:
Get all the blockdevices attached in the cluster with the following command. Modify the following command with appropriate namespace where the OpenEBS is installed. The default namespace where OpenEBS is getting installed is openebs
.
Example:
The output will be similar to the following.
The details of blockdevice can be get using the following command.
Example:
From the output, you will get the hostname and other blockdevice details such as State,Path,Claim State,Capacity etc.
Note: Identify block devices which are unclaimed, unmounted on node and does not contain any filesystem. The above command will help to find these information. More information about the disk mount status on node can be read from here.
Step2:
Create a StoragePoolClaim configuration YAML file called cstor-pool1-config.yaml
with the following content. In the following YAML, PoolResourceRequests
value is set to 2Gi
and PoolResourceLimits
value is set to 4Gi
. The resources will be shared for all the volume replicas that reside on a pool. The value of these resources can be 2Gi to 4Gi per pool on a given node for better performance. These values can be changed as per the Node configuration for better performance. Refer setting pool policies for more details on the pool policies applicable for cStor.
In the above file, change the following parameters as required.
poolType
This field represents how the data will be written to the disks on a given pool instance on a node. Supported values are
striped
,mirrored
,raidz
andraidz2
.Note: In OpenEBS, the pool instance does not extend beyond a node. The replication happens at volume level but not at the pool level. See volumes and pools relationship in cStor for a deeper understanding.
blockDeviceList
Select the list of selected unclaimed blockDevice CRs which are unmounted and does not contain a filesystem in each participating nodes and enter them under
blockDeviceList
.To get the list of blockDevice CRs, use
kubectl get blockdevice -n openebs
.You must enter all selected blockDevice CRs manually together from the selected nodes.
When the
poolType
=mirrored
, ensure the number of blockDevice CRs selected from each node are an even number. The data is striped across mirrors. For example, if 4x1TB blockDevice are selected onnode1
, the raw capacity of the pool instance ofcstor-disk-pool
onnode1
is 2TB.When the
poolType
=striped
, the number of blockDevice CRs from each node can be in any number. The data is striped across each blockDevice. For example, if 4x1TB blockDevices are selected onnode1
, the raw capacity of the pool instance ofcstor-disk-pool
on thatnode1
is 4TB.When the
poolType
=raidz
, ensure that the number of blockDevice CRs selected from each node are like 3,5,7 etc. The data is written with single parity. For example, if 3x1TB blockDevice are selected on node1, the raw capacity of the pool instance ofcstor-disk-pool
on node1 is 2TB. 1 disk will be used as a parity disk.When the
poolType
=raidz2
, ensure that the number of blockDevice CRs selected from each node are like 6,8,10 etc. The data is written with dual parity. For example, if 6x1TB blockDevice are selected on node1, the raw capacity of the pool instance ofcstor-disk-pool
on node1 is 4TB. 2 disks will be used for parity.The number of selected blockDevice CRs across nodes need not be the same. Unclaimed blockDevice CRs which are unmounted on nodes and does not contain any filesystem can be added to the pool spec dynamically as the used capacity gets filled up.
type
This value can be either
sparse
ordisk
. If you are creating a sparse pool using the sparse disk based blockDevice which are created as part of applying openebs operator YAML, then choose type assparse
. For other blockDevices, choose type asdisk
.
Step3:
After the StoragePoolClaim configuration YAML spec is created, run the following command to create the pool instances on nodes.
Verify cStor Pool configuration is created successfully using the following command.
The following is an example output.
Verify if cStor Pool is created successfully using the following command.
The following is an example output.
Verify if cStor pool pods are running using the following command.
Example:
Example Output:
If all pods are showing are running, then you can use these cStor pools for creating cStor volumes.
Note: The cStor pool can be horizontally scale up on new OpenEBS Node by editing the corresponding pool configuration YAML with the new disks name under blockDeviceList
. More details can be found here. If you find any issues, check common issues added in troubleshooting section.
The resiliency of the cStor storage pool can be verified via
litmus
using cStor-pool-chaos experiment.
#
Setting Pool PoliciesThis section captures the policies supported for cStorPools in StoragePoolClaim
under cas.openebs.io/config
in the name and value pair format.
#
PoolResourceLimits PolicyThis feature allow you to set the limits on memory and cpu for pool pods. The resource and limit value should be in the same format as expected by Kubernetes. The name
of SPC can be changed if you need.
#
PoolResourceRequests PolicyThis feature allow you to specify pool resource requests that need to be available before scheduling the containers. If not specified, the default values are used. The following sample configuration will set memory as 2Gi
and ephemeral-storage request value as 100Mi
. The memory will be shared for all the volume replicas that reside on a pool. The memory can be 2Gi
to 4Gi
per pool on a given node for better performance. These values can be changed as per the node configuration for better performance. The below configuration also set the cstor-pool
container with 100Mi
as ephemeral-storage
requests which will avoid erroneous eviction by K8s.
#
TolerationscStor pool pods can be ensure that pods are not scheduled onto inappropriate nodes. This can be achieved using taint and tolerations method. If Nodes are tainted to schedule the pods which are tolerating the taint, then cStor pool pods also can be scheduled using this method. Tolerations are applied to cStor pool pods, and allow (but do not require) the pods to schedule onto nodes with matching taints.
#
AuxResourceLimits PolicyYou can specify the AuxResourceLimits which allow you to set limits on side cars.
#
AuxResourceRequests PolicyThe below configuration will set the cstor-pool side-cars with memory as 0.5Gi
, cpu as 100m
. This also set the cstor-pool
side-cars with ephemeral-storage request 50Mi
which will avoid erroneous eviction by K8s.
#
Creating cStor Storage ClassStorageClass definition is an important task in the planning and execution of OpenEBS storage. As detailed in the CAS page, the real power of CAS architecture is to give an independent or a dedicated storage engine like cStor for each workload, so that granular policies can be applied to that storage engine to tune the behaviour or performance as per the workload's need. In OpenEBS policies to the storage engine (in this case it is cStor) through the annotations
specified in the StorageClass
interface.
#
Steps to Create a cStor StorageClassStep1: Decide the cStorPool and get the StoragePoolClaim name associated to it.
Step2: Which application uses it? Decide the replicaCount based on your requirement. OpenEBS doesn't restrict the replica count to set, but only maximum up to 5 replicas are allowed. It depends how users configure it, but for the availability of volumes at least (n/2 + 1) replicas should be up and connected to the target, where n
is the replicaCount
. The following are some example cases:
- If user configured replica count as 2, then always 2 replicas should be available to perform operations on volume.
- If replica count as 3 it should require at least 2 replicas should be available for volume to be operational.
- If replica count as 5 it should require at least 3 replicas should be available for volume to be operational.
Step3: Are there any other storage policies to be applied to the StorageClass? Refer to the storage policies section for more details on the storage policies applicable for cStor.
Step4: Create a YAML spec file <storage-class-name.yaml>
from the master template below, update the pool, replica count and other policies and create the class using kubectl apply -f <storage-class-name.yaml>
command.
Step5: Verify the newly created StorageClass using kubectl describe sc <storage-class-name>
#
Example Configuration of OpenEBS StorageClassYou can create a new StorageClass YAML called openebs-sc-rep3.yaml and add content to it from below. By using this spec, a StorageClass will be created with 3 OpenEBS cStor replicas and will configure them on the pools associated with the StoragePoolClaim:cstor-disk-pool
.
#
Setting Storage PoliciesBelow table lists the storage policies supported by cStor. These policies should be built into StorageClass and apply them through PersistentVolumeClaim or VolumeClaimTemplates interface. StoragePoolClaim
is the mandatory policy to be specified in all the storage class definitions.
cStor Storage Policy | Mandatory | Default | Purpose |
---|---|---|---|
ReplicaCount | No | 3 | Defines the number of cStor volume replicas |
VolumeControllerImage | openebs/cstor-volume-mgmt:2.11.0 | Dedicated side car for command management like taking snapshots etc. Can be used to apply a specific issue or feature for the workload | |
VolumeTargetImage | openebs/cstor-istgt:2.11.0 | iSCSI protocol stack dedicated to the workload. Can be used to apply a specific issue or feature for the workload | |
StoragePoolClaim | Yes | N/A (a valid pool must be provided) | The cStorPool on which the volume replicas should be provisioned |
VolumeMonitor | ON | When ON, a volume exporter sidecar is launched to export Prometheus metrics. | |
VolumeMonitorImage | openebs/m-exporter:2.11.0 | Used when VolumeMonitor is ON. A dedicated metrics exporter to the workload. Can be used to apply a specific issue or feature for the workload | |
FSType | ext4 | Specifies the filesystem that the volume should be formatted with. Other values are xfs | |
TargetNodeSelector | Decided by Kubernetes scheduler | Specify the label in key: value format to notify Kubernetes scheduler to schedule cStor target pod on the nodes that match label | |
TargetResourceLimits | Decided by Kubernetes scheduler | CPU and Memory limits to cStor target pod | |
TargetResourceRequests | Decided by Kubernetes scheduler | Configuring resource requests that need to be available before scheduling the containers. | |
TargetTolerations | Decided by Kubernetes scheduler | Configuring the tolerations for target. | |
AuxResourceLimits | Decided by Kubernetes scheduler | Configuring resource limits on the volume pod side-cars. | |
AuxResourceRequests | Decided by Kubernetes scheduler | Configure minimum requests like ephemeral storage etc. to avoid erroneous eviction by K8s. | |
Target Affinity | Decided by Kubernetes scheduler | The policy specifies the label KV pair to be used both on the cStor target and on the application being used so that application pod and cStor target pod are scheduled on the same node. | |
Target Namespace | openebs | When service account name is specified, the cStor target pod is scheduled in the application's namespace. | |
cStorStoragePool Replica Anti-Affinity | Decided by Kubernetes scheduler | For StatefulSet applications, to distribute single replica volume on separate nodes . |
#
Storage Pool Claim PolicyYou can specify the cStor Pool Claim name using the value for StoragePoolClaim property. This will help you choose cStor storage pool where OpenEBS volume will be created. Following is the default StorageClass template where cStor volume will be created on default cStor Sparse Pool.
#
Replica Count PolicyYou can specify the cStor volume replica count using the ReplicaCount property. You need to ensure that the replica count should not be more than the pools created in the respective StoragePoolClaim. In the following example, the ReplicaCount is specified as 3. Hence, three cStor volume replicas will be created.
#
Volume Controller Image PolicyYou can specify the cStor Volume Controller Image using the value for VolumeControllerImage property. This will help you choose the volume management image.
#
Volume Target Image PolicyYou can specify the cStor Target Image using the value for VolumeTargetImage property. This will help you choose the cStor istgt target image.
#
Volume Monitor PolicyYou can specify the cStor volume monitor feature which can be set using value for the VolumeMonitor property. By default, volume monitor is enabled.
#
Volume Monitoring Image PolicyYou can specify the monitoring image policy for a particular volume using value for VolumeMonitorImage property. The following sample storage class uses the Volume Monitor Image policy.
#
Volume File System Type PolicyYou can specify the file system type for the cStor volume where application will consume the storage using value for FSType. The following is the sample storage class. Currently OpenEBS support ext4 as the default file system and it also supports XFS.
#
Target NodeSelector PolicyYou can specify the TargetNodeSelector where Target pod has to be scheduled using the value for TargetNodeSelector. In following example, node: appnode
is the node label.
#
Target ResourceLimits PolicyYou can specify the TargetResourceLimits to restrict the memory and cpu usage of target pod within the given limit using the value for TargetResourceLimits .
#
TargetResourceRequests PolicyYou can specify the TargetResourceRequests to specify resource requests that need to be available before scheduling the containers.
#
TargetTolerations PolicyYou can specify the TargetTolerations to specify the tolerations for target.
#
AuxResourceLimits PolicyYou can specify the AuxResourceLimits which allow you to set limits on side cars.
#
AuxResourceRequests PolicyThis feature is useful in cases where user has to specify minimum requests like ephemeral storage etc. to avoid erroneous eviction by K8s. AuxResourceRequests
allow you to set requests on side cars. Requests have to be specified in the format expected by Kubernetes
#
Target Affinity PolicyThe StatefulSet workloads access the OpenEBS storage volume by connecting to the Volume Target Pod. This policy can be used to co-locate volume target pod on the same node as workload.
The configuration for implementing this policy is different for deployment and StatefulSet applications.
#
For StatefulSet ApplicationsIn the case of provisioning StatefulSet applications with replication factor greater than "1" and volume replication factor equal to "1", for a given OpenEBS volume, target and replica related to that volume should be scheduled on the same node where the application pod resides. This feature can be achieved by using either of the following approaches.
Approach 1:
In this approach, modification is required on StatefulSet spec and corresponding StorageClass being used in the StatefulSet spec. Add openebs.io/sts-target-affinity: <metadata.name of STS>
label in StatefulSet spec to the following fields.
- spec.selector.matchLabels
- spec.template.labels
Example snippet:
Do the following changes in the StorageClass that is referred in the claimTemplates of this StatefulSet.
- Set volumeBindingMode to WaitForFirstConsumer
Example snippet:
Approach 2:
This approach is useful when user/tool does not have control over the StatefulSet spec. In this case, it requires a new StorageClass per StatefulSet application.
Add following changes in the StorageClass that is referred to by the claimTemplates of this StatefulSet.
- Add openebs.io/sts-target-affinity:
<metadata.name of STS>
label to the following fields.- metadata.labels
- Set volumeBindingMode to WaitForFirstConsumer
Example snippet:
Note: It is recommended to do application pod stickiness for seamless working of the above approaches. Example YAML spec for STS can be referred from here.
#
For Deployment ApplicationsThis feature makes use of the Kubernetes Pod Affinity feature that is dependent on the Pod labels. User will need to add the following label to both Application and PVC.
You can specify the Target Affinity in both application and OpenEBS PVC using the following way. For Application Pod, it will be similar to the following.
The following is the sample snippet of the PVC to use Target affinity.
Note: This feature works only for cases where there is a 1-1 mapping between a application and PVC.
#
Target NamespaceBy default, the cStor target pods are scheduled in a dedicated openebs namespace. The target pod also is provided with OpenEBS service account so that it can access the Kubernetes Custom Resource called CStorVolume
and Events
.
This policy, allows the Cluster administrator to specify if the Volume Target pods should be deployed in the namespace of the workloads itself. This can help with setting the limits on the resources on the target pods, based on the namespace in which they are deployed.
To use this policy, the Cluster administrator could either use the existing OpenEBS service account or create a new service account with limited access and provide it in the StorageClass as follows:
The sample service account can be found here.
#
cStorStoragePool Replica Anti-AffinityThis policy will adds the ability in cStor to correlate and hence distribute single replica volumes across pools which are in turn deployed in separate nodes when application consuming all these volumes is deployed as a StatefulSet.
Below are supported anti-affinity features:
openebs.io/replica-anti-affinity: <unique_identification_of_app_in_cluster>
openebs.io/preferred-replica-anti-affinity: <unique_identification_of_app_in_cluster>
Below is an example of a statefulset YAML spec that makes use of openebs.io/replica-anti-affinity
:
#
Upgrade the Software Version of a cStor poolThe steps for upgrading cStor Pool is mentioned in Upgrade section. Refer Upgrade section for more details.
#
Monitor a cStor PoolA new sidecar will run once a cStor pool pod is created. This sidecar will collect the metrics of the corresponding cStorStoragePool. Following metrics are supported by cStor to export the cStorStoragePool usage statistics as Prometheus metrics.
#
Setting Performance TuningsAllow users to set available performance tunings in StorageClass based on their workload. Below are the tunings that are required:
- cStor target queue depth
- This limits the ongoing IO count from client. Default is 32.
- cStor target worker threads
- Sets the number of threads that are working on above queue. It is mentioned by
Luworkers
. Default value is 6. In case of better number of cores and RAM, this value can be 16. This means 16 threads will be running for each volume.
- Sets the number of threads that are working on above queue. It is mentioned by
- cStor volume replica worker threads
- This Is associated with cStorVolumeReplica.
- It is mentioned by
ZvolWorkers
. - Defaults to the number of cores on the machine.
- In case of better number of cores and RAM, this value can be 16.
Note: These configuration can be only used during volume provisioning. Default values will be used in case of "Invalid/None" values has been provided using configuration.
Example Configuration:
Note: For sequential workload, setting luworkers
to 1 is good. For random workload, default setting to 6 is good.
#
Expanding cStor Pool to a New NodecStorPools can be horizontally scaled when needed typically when a new Kubernetes node is added or when the existing cStorPool instances become full with cStorVolumes. This feature is added in 0.8.1.
The steps for expanding the pool to new nodes is given below.
#
With specifying blockDeviceListIf you are following this approach, you should have created cStor Pool initially using the steps provided here. For expanding pool onto a new OpenEBS node, you have to edit corresponding pool configuration(SPC) YAML with the required block device names under the blockDeviceList
.
Step 1: Edit the existing pool configuration spec that you originally used and apply it (OR) directly edit the in-use spec file using kubectl edit spc <SPC Name>
.
Step 2: Add the new disks names from the new Nodes under the blockDeviceList
. You can use kubectl get blockdevice -n <openebs_namespace>
to obtains the disk CRs.
Step 3: Apply or save the configuration file and a new cStorPool instance will be created on the expected node.
Step 4: Verify the new pool creation by checking
- If a new cStor Pool POD is created (
kubectl get pods -n openebs | grep <pool name>
) - If a new cStorPool CR is created (
kubectl get csp -n <openebs_installed_namespace>
)
#
Expanding Size of a cStor Pool Instance on a Node (by adding physical/virtual disks to a pool instance)A pool instance is local to a node. A pool instance can be started with as small as one disk (in striped
mode) or two disks (in mirrored
) mode. cStor pool instances support thin provisioning of data, which means that provisioning of any volume size will be successful from a given cstorPool config.
However, as the actual used capacity of the pool is utilized, more disks need to be added. Currently the steps for adding more disks to the existing pool is done through manual operations.You can add more disks to the existing StoragePool with the steps provide here.
#
Expanding size of a cStor Pool Instance on a Node (by expanding the size of cloud disks)When you have a cloud disk and which is used for the creation of cStor Storage pool and when you want to expand the existing cStor pool capacity, you can expand the size of the cloud disk and reflect the change in the corresponding cStor storage pool. There by the cStor pool capacity can be increased. The steps for doing this activity is documented here.
#
Expanding the cStor Volume CapacityOpenEBS control plane does not support increasing the size of volume seamlessly. Increasing the size of a provisioned volume requires support from Kubernetes kubelet as the existing connection has to be remounted to reflect the new volume size. This can also be tackled with the new CSI plugin where the responsibility of the mount, unmount and remount actions will be held with the vendor CSI plugin rather than the kubelet itself.
OpenEBS team is working on both the CSI plugin as well as the feature to resize the provisioned volume when the PVC is patched for new volume size. Currently this is a manual operation and the steps for expanding the cStor volume is mentioned here.
#
Scaling up cStor Volume ReplicaThis section provide the steps for scaling up the replica of a cStor volume.
#
Prerequisite for scaling up the replicas of cStor volume- A cStor pool should be available and replica of this cStor volume should not be present on this cStor pool.
- OpenEBS version should be 1.3.0 or more.
#
Overview- Get the current replica count of the cStor volume which is mentioned in corresponding StorageClass.
- Find cStor pool(s) where existing cStor volume replica(s) is created.
- Find available cStor pools where new cStor volume replica should be created.
- Verify new cStor Volume Replica(s) is created for the particular volume on the available cStor pool(s).
#
Steps to perform cStor volume replica scale up:Get the current replica count of the cStor volume which is mentioned in corresponding StorageClass. Get the StorageClass name using the following command:
Example output:
Perform the following command to get the details of corresponding StorageClass which is used for creating the cStor volume :
In this example, cStor volume is created using this StorageClass
openebs-sc-cstor
.Example snippet of output:
In the above example snippet, it is showing that current cStor volume replica count is 1.
Get the PVC details using the following command:
Example output:
From the above output, get
VOLUME
name and use in the following command to get the details of corresponding cStor volume. All commands are performed by considering above PVC.Get the details of cStor volume details using the following command:
Example output:
Get the details of existing cStor Volume Replica details using the following command:
Example output:
Perform the following command to get complete details of the existing cStor volume replica:
Example snippet of output:
Note down following parameters from the output. This is needed for creating new cStor Volume Replica in step 7.
metadata.annotations.openebs.io/storage-class-ref|
name:
metadata.labels.cstorvolume.openebs.io/name
metadata.labels.cstorvolume.openebs.io/persistent-volume
metadata.labels.cstorvolume.openebs.io/version
metadata.namespace
spec.capacity
spec.targetIP
versionDetails.desired
versionDetails.status.current
Perform the following command to get the cStor Pool where the existing cStor volume replica is created:
Example output:
Get the available cStor Pools for creating new cStor volume replica. The following command will get the other associated cStor pools details:
Example output:
From the above example output, there are 2 cStor pools available, ie: cstor-disk-pool-2phf and cstor-disk-pool-zm8l. So it is possible to scale up the current volume replica count to 3 from 1.
Note: If there are no cStor pools available to perform volume replica scale-up, then follow the steps to create new cStor pool by updating existing SPC configuration.
Perform the following command to get the details of the cStor Pool where new replica will be created:
Example snippet of output:
Note down following parameters from the output. This is needed for creating new cStor Volume Replica in step 7.
- metadata.annotations.cstorpool.openebs.io/hostname
- metadata.labels.cstorpool.openebs.io/name
- metadata.labels.cstorpool.cstorpool.openebs.io/uid
Create a CVR in the cStor pool identified in Step 5. Below is the template to create CVR on the identified cStor pool. The values in the template can be filled from CSP YAML related to identified cStor pool, and other CVRs of the volume.
<Kubernetes_node_name>: Kubernetes node name where cStor pool exists and new CVR will be created on this Node. This can be obtained from step 6.
<storage_class_name>: Storageclass name used to create the cStor volume. It is also available in any existing CVR. This can be obtained from step 3.
<csp_name>: Identified cStor pool name where new CVR will be created. This can be obtained from step 6.
<csp_uid>: UID of identified cStor pool name where new CVR will be created. This can be obtained from step 6.
<persistent_volume_name>: Kubernetes Persistent Volume name of the corresponding cStor volume. This can be obtained from step 3.
<openebs_version>: Version of OpenEBS on which this volume exist. This can be obtained from step 3.
<cstor_volume_name>: Name of cStor volume. This can be get from step 3.
<cstor_volume_name>-<csp_name>: This is the new CVR name which is going to be created. This should be named as a combination of particular cStor volume name and identified cStor pool name. This can be get from step 3 and step 6.
<initial_capacity>: Capacity of the cStor volume. This can be get from step 3.
<target_service_ip>: Target IP of corresponding cStor volume. This can be got from step 3.
<md5sum_of_pvc_uid_and_csp_uid>: It is the unique value referred to as
replicaid
in the whole cluster. This can be generated by running the following command:Example command:
In the above example pvc-uid is
3f86fcdf-02f6-11ea-b0f6-42010a8000f8
andcsp-uid
of identified cStor pool isca657af1-02f4-11ea-b0f6-42010a8000f8
Example output:
Example snippet of filled CVR YAML spec looks like below. :
In this example, CVR YAML spec is saved as
CVR2.yaml
.Apply the updated CVR YAML spec to create the new replica of cStor volume using the following command:
Example output:
Verify if new CVR is created successfully using the following command:
Example output:
From above output, new replica of the cStor volume is created and
STATUS
is showing asOffline
.Update
Desired Replication Factor
in cStor volume with new replica count. This can be updated by editing corresponding cStor volume CR YAML.The following is the snippet of updated cStor volume CR YAML:
In the above snippet,
desiredReplicationFactor
is updated to 2 from 1. Example output:Verify if the rebuilding has started on new replica of the cStor volume. Once rebuilding has completed, it will update its
STATUS
asHealthy
. Get the latest status of the CVRs using the following command:Example output:
Once the new replica of the cStor volume is in
Healthy
state, check the following parameters of the cStor volume to ensure that details are updated properly.- consistencyFactor
- desiredReplicationFactor
- spec.replicaDetails.knownReplicas
- spec.replicationFactor
- status.replicaDetails.knownReplicas
- status.replicaStatuses
The following command will get the details of cStor volume.
Example snippet:
In the above snippet,
Consistency Factor
andReplication Factor
is automatically updated and new replica is added underKnown Replicas
field.
#
Scaling down cStor Volume ReplicaThis section provide the steps for scaling down the replica of a cStor volume.
#
PrerequisitesAll the other cStor volume replicas(CVR) should be in
Healthy
state except the cStor volume replica that is going to deleted(i.e deleting CVR can be in any state).There shouldn't be any ongoing scale up process. Verify that
replicationFactor
should be equal to thedesiredReplicationFactor
from corresponding cStor volume CR specification.
Notes to remember:
- Scaling down one replica at a time is recommended. This means, only one replica at a time should be removed.
#
Overview- Get the details of corresponding cStor volume.
- Identify the replica of the cStor volume which needs to be removed.
- Modify the cStor volume specification with required change.
- Verify that the identified volume replica is removed successfully.
- Delete the CVR corresponding to the replicaID entry which was removed from cStor volume.
#
Steps to perform scaling down of cStor volume replicaPerform the following command to get the details of PVC:
From the output of above command, get
VOLUME
name and use in the following command to get the details of corresponding cStor volume. All commands are performed by considering above PVC.Example output:
Perform the following command to get the details of the replicas of corresponding cStor volume:
Example output:
Identify the cStor volume replica from above output which needs to be removed. Then, perform the following command to get the
replicaid
of the corresponding cStor volume replica. In this example, identified cStor volume replica ispvc-ed6e893a-051d-11ea-a786-42010a8001c9-cstor-disk-pool-c0tw
.Example snippet:
From the above output,
replicaid
of the identified cStor volume replica is4858867E8F150C533A2CF30A5D5FD8C6
.Modify the corresponding cStor volume specification to remove the identified cStor volume replica and update the
desiredReplicationFactor
. The cStor volume can be edited by using the following command:The following are the items need to be updated if you are scaling down the replica count from 3 to 2.
In the below snippet,
desiredReplicationFactor
is updated to2
from3
and removed thereplicaid
entry of the identified volume replica4858867E8F150C533A2CF30A5D5FD8C6
fromspec.replicaDetails.knownReplicas
.Example snippet:
Verify that the identified replica has been removed from the cStor volume. The following section can be checked to verify the updated details and removal event messages of the cStor volume.
Removal event message can be checked by describe the corresponding cStor volume using the following command:
Example snippet of output:
Verify the updated details of cStor volume using the following command:
Example snippet of output:
From the output, the following values are auto updated:
replicationFactor : It is updated to 2.
status.replicaDetails.knownReplicas : The
replicaid
entry of identified CVR is removed.
The status of CVRs corresponding to the cStor volume can be obtained by running the following command:
Example output:
From above output, identified CVR status is changed to
Offline
.Delete the identified CVR which was removed from cStor volume using the following command:
Example output:
Get the latest CVR details of corresponding cStor volume using the following command:
Example output:
#
See Also:Understand cStorPools cStorPool use case for Prometheus cStor roadmap