Tutorial: Create storage classes for your Saagie platform

This tutorial will help you create storage classes to store data in a non-volatile device during and after the running of your platform.

1. Create storage classes

The storage.yml file contains the configuration for your storageClass resources:

  • common-storageclass: Used to store Saagie data, such as databases.

  • <prefix>-storageclass: Used to store job data, such as uploaded artifacts.

  • <prefix>-app-storageclass: Optional storageClass to store app data and job data on different provisioner.

    <prefix> is the same value you determined for your DNS entry.

1.1. Create a storage.yml file for Amazon EKS

Here is a sample storage.yml for Amazon EKS that can be customized according to your needs:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: common-storageclass
parameters:
  type: gp2
  fsType: ext4
provisioner: kubernetes.io/aws-ebs
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-storageclass (1)
parameters:
  type: gp2
  fsType: ext4
provisioner: kubernetes.io/aws-ebs

To store app data and job data on different provisioners, include the following in the same storage.yml file:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-app-storageclass (1)
parameters: (2)

provisioner: (3)
<prefix> must be a 12 lowercase alphanumeric characters maximum string.
No special characters.
1 Replace <prefix> with the same value determined for your DNS entry.
2 Add the parameters for app data.
3 Indicate your second provisioner used to store app data.

1.2. Create a storage.yml file for Azure AKS

Here is a sample storage.yml for Azure AKS that can be customized according to your needs:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: common-storageclass
parameters:
  cachingmode: ReadOnly
  kind: Managed
  storageaccounttype: Standard_LRS
provisioner: kubernetes.io/azure-disk
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-storageclass (1)
parameters:
  cachingmode: ReadOnly
  kind: Managed
  storageaccounttype: Standard_LRS
provisioner: kubernetes.io/azure-disk

To store app data and job data on different provisioners, include the following in the same storage.yml file:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-app-storageclass (1)
parameters: (2)

provisioner: (3)
1 Replace <prefix> with the same value determined for your DNS entry.
2 Add the parameters for app data.
3 Indicate your second provisioner used to store app data.

1.3. Create a storage.yml file for Google GKE

Here is a sample storage.yml for Google GKE that can be customized according to your needs:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: common-storageclass
parameters:
  type: pd-standard
provisioner: kubernetes.io/gce-pd
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-storageclass (1)
parameters:
  type: pd-standard
provisioner: kubernetes.io/gce-pd

To store app data and job data on different provisioners, include the following in the same storage.yml file:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-app-storageclass (1)
parameters: (2)

provisioner: (3)
1 Replace <prefix> with the same value determined for your DNS entry.
2 Add the parameters for app data.
3 Indicate your second provisioner used to store app data.

1.4. Create a storage.yml file for other provider

Here is a sample storage.yml file for OVH that can be customized according to your needs. Refer to the Kubernetes documentation for more detailed information.

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: common-storageclass
parameters:
  availability: nova
  type: classic
provisioner: cinder.csi.openstack.org
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-storageclass (1)
parameters: (2)
  availability: nova
  type: classic
provisioner: cinder.csi.openstack.org (3)

To store app data and job data on different provisioners, include the following in the same storage.yml file:

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <prefix>-app-storageclass (1)
parameters: (2)

provisioner: (3)
1 Replace <prefix> with the same value determined for your DNS entry.
2 Add the parameters for app data.
3 Indicate your second provisioner used to store app data.

2. Apply storage.yml

  1. Run the following command to apply your storage.yml file:

    kubectl apply -f storage.yml
  2. Run the following command to confirm that the storage classes are available:

    kubectl get sc

    The output should be similar to this for Amazon EKS:

NAME                   PROVISIONER              RECLAIMPOLICY    VOLUMEBINDINGMODE     ALLOWVOLUMEEXPANSION   AGE
common-storageclass    kubernetes.io/aws-ebs    Delete           Immediate             false                  2m43s
gp2 (default)          kubernetes.io/aws-ebs    Delete           WaitForFirstConsumer  false                  5h25s
<prefix>-storageclass  kubernetes.io/aws-ebs    Delete           Immediate             false                  30s