AWS EKS Cluster Storage Initialization
Integration with AWS EKS and storage initialization configuration.
Constraints and Limitations
-
The default
efs-scfile storage class may not support permission changes after mounting, which can cause some applications like PostgreSQL and Jenkins to not work correctly. -
The A1 series instances do not support deploying the EBS block storage plugin (Amazon EBS CSI Driver). If you need to use storage classes of the EBS block storage type, please avoid using the following instance types:
- a1.medium
- a1.large
- a1.xlarge
- a1.2xlarge
- a1.4xlarge
Prerequisites
-
Ensure that Kubectl and AWS CLI tools are available.
-
If you have already created an EKS cluster, access the Amazon EKS cluster ; if you haven’t created an EKS cluster, create an AWS EKS cluster .
-
Deploy the EFS file storage plugin Amazon EFS CSI Driver and EBS block storage plugin Amazon EBS CSI Driver in the EKS cluster.
Note: If using EFS file storage, create a file system in the EKS region and record and save the File System ID.
Procedures
Create Storage Class
-
Go to Platform Management, click Storage Management > Storage Class in the left navigation bar.
-
Click Create Storage Class on the right side
> YAML Create. -
Add the following content to the YAML file to create a default storage class as needed. The default storage class names are efs-sc for file storage and ebs-sc for block storage.
-
EFS File Storage
Note: Replace
<File System ID>with the actual File System ID. For example:fileSystemId: fs-05aef9e1edd309f2b.kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: efs-sc provisioner: efs.csi.aws.com parameters: provisioningMode: efs-ap fileSystemId: <File System ID> directoryPerms: "755" -
EBS Block Storage
allowVolumeExpansion: true apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ebs-sc provisioner: ebs.csi.aws.com reclaimPolicy: Delete volumeBindingMode: WaitForFirstConsumer
-
-
Click Create.
Note: If the default storage class doesn’t meet your requirements, you can create a new storage class and modify the corresponding parameters as needed. Refer to Storage Class Available Parameters for details.
Modify Storage Class Assignment to Projects
-
In the left navigation bar, click Storage Management > Storage Class.
-
Click the Update Project
button on the right of the storage class named efs-sc or ebs-sc. -
Choose how to Assign Projects as needed, then click Update to assign the storage class to projects for use.
Related Operations
Configure Storage Class Available Parameters
-
Available parameters for EFS (Elastic File System) file storage:
Parameter Options Default Value Optional Description “az” "" true Used for cross-account mounting. If specified, it will use the mount target associated with the specified availability zone (az) for cross-account mounting. If not specified, a random mount target will be chosen for cross-account mounting. “basePath” true Used to specify the path for creating dynamic configuration access points. If not specified, the access point will be created at the root directory of the file system. “directoryPerms” false Used to specify directory permissions for creating Access Point root directories . “uid” true Used to specify the POSIX User ID for creating Access Point root directories . “gid” true Used to specify the POSIX Group ID for creating Access Point root directories . “gidRangeStart” 50000 true Specifies the starting range for POSIX Group IDs when creating Access Point root directories . Not required if uid/gid are set. “gidRangeEnd” 7000000 true Specifies the ending range for POSIX Group IDs. Not required if uid/gid are set. “subPathPattern” /${.PV.name} true Used to build the template for sub-paths, with each access point created under this template. It can consist of fixed strings and limited variables, similar to the “subPathPattern” variable in the nfs-subdir-external-provisioner chart, with optional parameters of .PVC.name, .PVC.namespace, and .PV.name. “ensureUniqueDirectory” true true true Used when enabling dynamic provisioning. When set to true, it appends the UID to the pattern specified in subPathPattern to ensure that access points do not accidentally point to the same directory.
Note: Set this parameter to false only when you are certain that this is the behavior you want.“provisioningMode” efs-ap false The volume type provided by EFS, currently supporting access points. “fileSystemId” false The file system ID of an existing access point. -
Available parameters for EBS block storage:
Note: You can refer to Amazon EBS Volume Types for performance parameters of different volume types.
Parameter Options Default Description “allowAutoIOPSPerGBIncrease” true, false false When set to “true,” the CSI driver increases the IOPS of the volume if iopsPerGB * is too low to meet the AWS-supported IOPS range. This ensures that dynamic provisioning is always successful, even if the PVC capacity or iopsPerGB value specified by the user is too low. However, it may incur additional costs because the IOPS of such volumes will be higher than the requirements in iopsPerGB. “blockExpress” true, false false By raising the IOPS limit of io2 volumes to 256,000, you can create io2 Block Express volumes. However, volumes with IOPS exceeding 64,000 cannot be mounted on instances that do not support io2 Block Express. “blockSize” Used to specify the block size to be used when formatting the underlying file system. This parameter applies only to Linux nodes with file system types ext2, ext3, ext4, or xfs. “bytesPerINode” Used to specify the number of bytes per inode (index node) to be used when formatting the underlying file system. This parameter applies only to Linux nodes with file system types ext2, ext3, or ext4. “csi.storage.k8s.io/fstype” xfs, ext2, ext3, ext4 ext4 Specifies the file system type to be formatted when creating the volume. This parameter is case-sensitive. “encrypted” true, false false Specifies whether the volume should be encrypted. “inodeSize” Used to specify the inode (index node) size to be used when formatting the underlying file system. This parameter applies only to Linux nodes and is required for file system types ext2, ext3, ext4, or xfs. Inodes are data structures used in the file system to store metadata information about files and directories. “iops” Specifies the number of I/O operations per second (IOPS) per second. It can be applied to different types of volumes such as IO1, IO2, and GP3 volumes. “iopsPerGB” Specifies the number of I/O operations per second (IOPS) per GiB per second. You can apply this to different types of volumes like IO1, IO2, and GP3 volumes. “kmsKeyId” Specifies the complete ARN of the key to be used when encrypting the volume. If no key is specified, AWS uses the default KMS key for the region of the volume and generates a key named “/aws/ebs.” “numberOfINodes” Specifies the number of inodes to be used when formatting the underlying file system. This parameter applies only to Linux nodes and is required for file system types ext2, ext3, or ext4. “throughput” 125 Specifies the throughput in MiB/s (Mebibytes per second). It is only effective when specifying gp3 volume types. If left empty, it defaults to 125 MiB/s. Please refer to Amazon EBS Volume Types for details. “type” io1, io2, gp2, gp3, sc1, st1, standard, sbp1, sbg1 gp3 Specifies the EBS volume type.