Creating a storage class
Create a storage class.
Required user type or access level: Cluster administrator
When you create a storage class, consider these storage classes and their associated quality of service (QoS).
Storage class name | QoS ((Input/output operations per second (IOPS)/size) |
---|---|
ibmc-file-bronze | 2 IOPS |
ibmc-file-silver | 4 IOPS |
ibmc-file-gold | 10 IOPS |
ibmc-file-custom | Variable size/and IOP |
ibmc-block-bronze | 2 IOPS |
ibmc-block-silver | 4 IOPS |
ibmc-block-gold | 10 IOPS |
ibmc-block-custom | Variable size/and IOP |
Creating storage classes during IBM Cloud Private installation
You can create a storage class during the installation of IBM Cloud Private. After the installation is complete, the storage class is created and can be used for dynamic storage provisioning.
Note: Only Kubernetes storage classes are supported.
Complete these steps to provide a storage class definition file:
- Create a
YAML
file with the storage class definitions. For information about storage class definitions, refer to the Kubernetes documentation. - Save the
YAML
file in the/<installation_directory>/cluster/misc/storage_class
folder.
Note: Do not place any other files in the /misc/storage_class
location. The IBM Cloud Private installer picks only the storage class YAML
files from the directory and ignores any other file.
Storage class examples
For instructions to create GlusterFS and vSphere storage classes in IBM® Cloud Private, see Creating a storage class for GlusterFS and Creating a storage class for vSphere volume.
For a list of several storage class definitions, see Storage Classes .
Basic storage class
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name:
provisioner: kubernetes.io/<plug-in-type>
parameters:
parameter 1: value
...
parameter N: value
Where:
kind: StorageClass
is the API.apiVersion: storage.k8s.io/v1
is the API version.metadata: name:
is the name of the storage class.provisioner: kubernetes.io/<plug-in-type>
is the name of the storage provisioner.parameters
describe the volumes that belong to the storage class. Parameters are optional and they vary with the provisioner.
GlusterFS
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: slow
provisioner: kubernetes.io/glusterfs
parameters:
resturl: "http://127.0.0.1:8081"
clusterid: "630372ccdc720a92c681fb928f27b53f"
restauthenabled: "true"
restuser: "admin"
secretNamespace: "default"
secretName: "heketi-secret"
gidMin: "40000"
gidMax: "50000"
volumetype: "replicate:3"
Where:
resturl
is a mandatory Gluster REST service URL or Heketi service URL that provisions Gluster volumes on demand. The general format isIP address:Port
. If the Heketi service is exposed as a routable service in the Kubernetes configuration, theresturl
can have a format likehttp://heketi-storage-project.cloudapps.mystorage.com
, where the FQDN is a resolvable Heketi service URL.restauthenabled
is a Gluster REST service authentication Boolean that enables authentication to the REST server. If this value istrue
, you must specify eitherrestuser
andrestuserkey
orsecretNamespace
+secretName
. This option is deprecated; authentication is enabled when any of these parameters are specified:restuser
restuserkey
secretName
secretNamespace
restuser
is the Gluster REST service user or Heketi user who can create volumes in the Gluster Trusted Pool.restuserkey
is the password of the Gluster REST service user or Heketi user to use for authentication to the REST server. This option is deprecated in favor ofsecretNamespace
+secretName
.secretNamespace
andsecretName
are optional. They identify a secret instance that contains the password to use to communicate with the Gluster REST service. IfsecretNamespace
andsecretName
are not specified, an empty password is used. The provided secret must have type “kubernetes.io/glusterfs”.clusterid: 630372ccdc720a92c681fb928f27b53f
is optional. This ID is the ID of the cluster that Heketi uses to provision the volume. It can also be a list of cluster IDs separated by commas.gidMin
andgidMax
are optional. They are the minimum and maximum values of the GID range for the storage class. A unique value (GID) in this range (gidMin - gidMax) is used for dynamically provisioned volumes. IfgidMin
andgidMax
are not specified, the volume is provisioned with a value that is in the range 2000 - 2147483647, which are defaults forgidMin
andgidMax
, respectively.volumetype
is the volume type and its parameters. The volume type is optional; if it isn't specified, the provisioner decides the volume type. Examples:‘Replica volume’: volumetype: replicate:3
where3
is the replica count;‘Disperse/EC volume’: volumetype: disperse:4:2
where4
is the data and2
is the redundancy count;‘Distribute volume’: volumetype: none
.
vSphere
-
Create a PersistentVolume with a user-specified disk format.
kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: fast provisioner: kubernetes.io/vsphere-volume parameters: diskformat: zeroedthick
Where the
diskformat
value isthin
,zeroedthick
, oreagerzeroedthick
. The default value isthin
. -
Create a PersistentVolume with a disk format on a user-specified datastore.
kind: StorageClass apiVersion: storage.k8s.io/v1beta1 metadata: name: fast provisioner: kubernetes.io/vsphere-volume parameters: diskformat: zeroedthick datastore: VSANDatastore
diskformat
:thin
,zeroedthick
, oreagerzeroedthick
. Default:thin
.datastore
: You can also specify the datastore in theStorageClass
. The volume is created on the datastore that is specified in the storage class, which in this case isVSANDatastore
. This field is optional. If it isn't specified, as in the previous YAML description, the volume is created on the datastore that is specified in the vSphere config file that is used to initialize vSphere Cloud Provider.
-
Create a PersistentVolume with user-specified VSAN storage capabilities.
kind: StorageClass apiVersion: storage.k8s.io/v1beta1 metadata: name: vsan-policy-fast provisioner: kubernetes.io/vsphere-volume parameters: diskformat: thin hostFailuresToTolerate: "1" diskStripes: "2" cacheReservation: "20" datastore: VSANDatastore
You can specify VSAN storage capabilities for dynamic volume provisioning inside Kubernetes.
Storage policies capture storage requirements, such as performance and availability, for PersistentVolumes. These policies determine how the container volume storage objects are provisioned and allocated within the datastore to ensure the requested quality of service. Storage policies are composed of storage capabilities, which are typically represented by a key-value pair. The key is a specific property that the datastore can offer. The value is a metric or a range that the datastore ensures for a provisioned object, such as a container volume that is backed by a virtual disk.
VSAN exposes multiple storage capabilities. This table lists the VSAN storage capabilities that vSphere Cloud Provider supports:
Storage capability name | Description |
---|---|
cacheReservation | Flash read cache reservation |
diskStripes | Number of disk stripes per object |
forceProvisioning | Force provisioning |
hostFailuresToTolerate | Number of failures to tolerate |
iopsLimit | IOPS limit for object |
objectSpaceReservation | Object space reservation |
While the vSphere infrastructure administrator creates a storage class inside Kubernetes, he or she can specify storage requirements for applications in terms of storage capabilities. When the administrator creates a StorageClass, he or she must specify the storage capability names that are used in table 1 because those names might differ from the ones that VSAN uses. For example, Number of disk stripes per object is referred to as stripeWidth in VSAN documentation. However, vSphere Cloud Provider uses the name diskStripes.