安装EKS EFS CSI在Pod出现之前已超时

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装EKS EFS CSI在Pod出现之前已超时相关的知识,希望对你有一定的参考价值。

我正在将EKS与Kubernetes版本1.15一起使用,并且在创建存储类,持久卷,持久卷声明和部署时,pod失败,并显示以下错误:

Warning  FailedAttachVolume  71s (x2 over 3m11s)  attachdetach-controller              AttachVolume.Attach failed for volume "efs-pv" : attachment timeout for volume fs-<volume>
Warning  FailedMount         53s (x2 over 3m8s)   kubelet, ip-<ip-address>.ec2.internal  Unable to mount volumes for pod "influxdb-deployment-555f4c8b94-mldfs_default(2525d10b-e30b-4c4c-893e-10971e0c683e)": timeout expired waiting for volumes to attach or mount for pod "default"/"influxdb-deployment-555f4c8b94-mldfs". list of unmounted volumes=[persistent-storage]. list of unattached volumes=[persistent-storage]

但是,如果我尝试不构建持久卷而尝试相同的操作,它将成功,并创建自己的文件,从而似乎跳过CSI。这就是我正在使用的:

deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: influxdb-deployment
spec:
  selector:
    matchLabels:
      app: influxdb
  replicas: 1
  template:
    metadata:
      labels:
        app: influxdb
    spec:
      containers:
      - name: influxdb
        image: influxdb:1.7.10-alpine
        ports:
        - containerPort: 8086
        volumeMounts:
        - name: persistent-storage
          mountPath: /var/lib/influx
      volumes:
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: efs-claim

storageclass.yaml:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-sc
provisioner: efs.csi.aws.com
reclaimPolicy: Retain

persistent-volume.yaml:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    volumeHandle: fs-<volume-id>

persistent-volume-claim.yaml:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: efs-claim
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: efs-sc
  resources:
    requests:
      storage: 5Gi

有什么想法吗?

答案
这在aws EKS文档中没有明确说明,但是当您打算将storageclass用作首次设置时,这是必须做的。

以上是关于安装EKS EFS CSI在Pod出现之前已超时的主要内容,如果未能解决你的问题,请参考以下文章

部署在 EFS 上的 Nginx 和 PHP-FPM - 提高性能

Amazon EKS 中 EFS 持久性存储

Amazon EKS 中 EFS 持久性存储

eks使用efs dynamic provisioning 创建非root容器提示 Operation not permitted

在 AWS EKS 上扩展 pod 时出现 502 ALB 错误

AWS EKS Cluster Autoscaler - 缩减策略