skip to Main Content

My goal is to attach a dynamic volume claim to a deployment on EKS cluster, I am using this tutorial
https://aws.amazon.com/blogs/storage/persistent-storage-for-kubernetes/

My manifests are storage class, volume claim and a deployment : ( Same as from tutorial)

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-sc
provisioner: efs.csi.aws.com
parameters:
  provisioningMode: efs-ap
  fileSystemId: fs-XXXX
  directoryPerms: "700"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: efs-claim-1
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: efs-sc
  resources:
    requests:
      storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
  name: debug-app
spec:
  replicas: 1
  selector:
    matchLabels:
      component: debug-app
  template:
    metadata:
      labels:
        app: debug-app
        component: debug-app
    spec:
      containers:
      - image: ubuntu:20.04
        imagePullPolicy: IfNotPresent
        name: debug-app
        command: ["/bin/sh","-c"]
        args: 
          - sleep 3650d
        #command: ["/bin/sh","-c", "sleep 365d"]
        ports:
        - containerPort: 8000
        resources:
          limits:
            cpu: 2
            memory: 4Gi
          requests:
            cpu: 10m
            memory: 16Mi
        volumeMounts:
        - name: persistent-storage
          mountPath: /data
      volumes:
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: efs-claim-1

Storage class is well created, but

NAME     PROVISIONER       RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
efs-sc   efs.csi.aws.com   Delete          Immediate           false                  5m17s

persistent volume claim is on pending state with the following description

Events:
  Type     Reason                Age                     From                         Message
  ----     ------                ----                    ----                         -------
  Normal   ExternalProvisioning  2m18s (x17 over 6m18s)  persistentvolume-controller  waiting for a volume to be created, either by external provisioner "efs.csi.aws.com" or manually created by system administrator

It’s clear the efs storage can’t create the persisted volume, I went back and tried with newly created efs storage following
https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html

But the same issue persisted,

Any possible fixes here please?
Thanks

PS: Just mentioning here, I’m using no Fargate Profile

2

Answers


  1. Chosen as BEST ANSWER

    Well, I checked the csi driver installation on namespace kube-system, which had an ImagePullBack error,

    The tutorial https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html#efs-install-driver is mentionning an image eks/aws-efs-csi-driver, which doesn't exist.

    helm upgrade -i aws-efs-csi-driver aws-efs-csi-driver/aws-efs-csi-driver
    --namespace kube-system
    --set image.repository=602401143452.dkr.ecr.region-code.amazonaws.com/eks/aws-efs-csi-driver
    --set controller.serviceAccount.create=false
    --set controller.serviceAccount.name=efs-csi-controller-sa

    The correct image name from docker hub is amazon/aws-efs-csi-driver https://hub.docker.com/r/amazon/aws-efs-csi-driver

    I pushed this image to my repository, then re-installed csi driver with helm:

    helm upgrade -i aws-efs-csi-driver aws-efs-csi-driver/aws-efs-csi-driver 
        --namespace kube-system 
        --set image.repository=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-efs-csi-driver 
        --set controller.serviceAccount.create=false 
        --set controller.serviceAccount.name=efs-csi-controller-sa
    

    Now, volume is well attached and all is good, Thanks,


  2. I went back and tried with newly created efs storage following https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html

    But you didn’t install the driver. Hence you get ...waiting for a volume to be created, either by external provisioner "efs.csi.aws.com".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search