Preparing Redis Storage
About this task
Complete the following steps to configure storage for Redis.
For Redis, use /bitnami/redis as the root directory for the EFS access point.
Procedure
-
Create the EFS access point.
EFS_AP_REDIS=$(aws efs create-access-point \ --file-system-id $EFS_FS_ID \ --posix-user Uid=1000,Gid=1000 \ --root-directory "Path=/bitnami/redis,CreationInfo={OwnerUid=1000,OwnerGid=1000,Permissions=777}" \ --region $AWS_REGION \ --query 'AccessPointId' \ --output text) -
Create the Persistent Volume (PV) and link it to the EFS access
point.
echo " apiVersion: v1 kind: PersistentVolume metadata: name: link-redis-pv spec: capacity: storage: 5Gi volumeMode: Filesystem accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Retain storageClassName: efs-sc csi: driver: efs.csi.aws.com volumeHandle: $EFS_FS_ID::$EFS_AP_REDIS " | kubectl apply -f - -
Create the Persistent Volume Claim (PVC) and bind it to
the PV.
echo " apiVersion: v1 kind: PersistentVolumeClaim metadata: name: link-redis-pvc spec: accessModes: - ReadWriteMany storageClassName: efs-sc volumeName: link-redis-pv resources: requests: storage: 5Gi " | kubectl apply -f - -
Verify that the PVC was created and successfully bound to the PV:
kubectl get pvc link-redis-pvcExample output:NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE link-redis-pvc Bound link-redis-pv 5Gi RWX efs-sc <unset> 15s