How to Configure StorageClass with EBS for EKS cluster for Gitlab

Table of Contents

Method – 1

to create a volume in an availability zone where you don’t have any volumes on. You can try restricting your StorageClass to the availability zones where you have nodes.

A StorageClass is a way to describe a class of storage that can be used by Kubernetes Persistent Volumes (PVs). The kind: StorageClass and apiVersion: storage.k8s.io/v1 fields indicate that this is a Kubernetes StorageClass object using the version 1 of the Kubernetes storage API.

The metadata field contains information about the StorageClass, including its name gp2 and an annotation that specifies it as the default class for PVs, with storageclass.kubernetes.io/is-default-class: "true".

The provisioner field specifies the provisioner to be used to create PVs of this StorageClass, in this case, kubernetes.io/aws-ebs, indicating that the storage will be provided by Amazon Elastic Block Store (EBS) volumes.

The parameters field specifies parameters to be passed to the provisioner, in this case, specifying the type of storage to be created as gp2, which is a type of EBS volume optimized for general-purpose workloads.

The reclaimPolicy field specifies what happens to the PVs created from this StorageClass when they are no longer in use. Here, the policy is set to Retain, which means the PVs will not be automatically deleted when a claim is released, and their data will be preserved.

The mountOptions field specifies additional mount options to be used when the volume is mounted by a pod. Here, it’s set to debug.

The allowedTopologies field specifies where the PVs created from this StorageClass can be provisioned. Here, it specifies that the PVs can be provisioned in any of the availability zones (ap-southeast-1a, ap-southeast-1b, ap-southeast-1c) in the ap-southeast-1 region. This is done by using the matchLabelExpressions field to specify a label key (failure-domain.beta.kubernetes.io/zone) and the corresponding values.


kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: gp2
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
reclaimPolicy: Retain
mountOptions:
  - debug
allowedTopologies:
- matchLabelExpressions:
  - key: failure-domain.beta.kubernetes.io/zone
    values:
    - ap-southeast-1a
    - ap-southeast-1b
    - ap-southeast-1c

Method – 2

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x