Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How to Configure StorageClass with EBS for EKS cluster for Gitlab

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

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x