简体   繁体   English

EKS 中的持久存储无法配置卷

[英]Persistent Storage in EKS failing to provision volume

I followed the steps from AWS knowledge base to create persistent storage: Use persistent storage in Amazon EKS我按照AWS知识库中的步骤创建持久存储: 在 Amazon EKS 中使用持久存储

Unfortunately, PersistentVolume (PV) wasn't created:不幸的是,没有创建PersistentVolume (PV):

kubectl get pv
No resources found

When I checked the PVC logs, I'm getting the following provisioning failed message:当我检查 PVC 日志时,我收到以下配置失败消息:

storageclass.storage.k8s.io "ebs-sc" not found

failed to provision volume with StorageClass "ebs-sc": rpc error: code = DeadlineExceeded desc = context deadline exceeded

I'm using Kubernetes v1.21.2-eks-0389ca3我正在使用Kubernetes v1.21.2-eks-0389ca3


Update:更新:

The storageclass.yaml used in the example has provisioner set to ebs.csi.aws.com示例中使用的 storageclass.yaml 将配置器设置为 ebs.csi.aws.com

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer

When I updated it using @gohm'c answer, it created a pv.当我使用@gohm'c 答案更新它时,它创建了一个 pv。

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
storageclass.storage.k8s.io "ebs-sc" not found

failed to provision volume with StorageClass "ebs-sc"

You need to create the storage class "ebs-sc" after EBS CSI driver is installed, example:安装EBS CSI驱动后需要创建存储类“ebs-sc”,例如:

cat << EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com
parameters:
  type: gp3
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
EOF

See here for more options.请参阅此处了解更多选项。

Уour question has already been asked several times and it remained unanswered. У我们的问题已经被问过好几次了,但仍然没有答案。

Eg here: SweetOps #kubernetes for March, 2020例如: SweetOps #kubernetes 2020 年 3 月

Or here (need login to AWS console): AWS Developer Forums: PVC are in Pending state that are ...或者在这里(需要登录到AWS控制台): AWS 开发人员论坛:PVC 处于待处理状态...

The source code is here源代码在这里

    opComplete := util.OperationCompleteHook(plugin.GetPluginName(), "volume_provision")
    volume, err = provisioner.Provision(selectedNode, allowedTopologies)
    opComplete(volumetypes.CompleteFuncParam{Err: &err})
    if err != nil {
        // Other places of failure have nothing to do with VolumeScheduling,
        // so just let controller retry in the next sync. We'll only call func
        // rescheduleProvisioning here when the underlying provisioning actually failed.
        ctrl.rescheduleProvisioning(claim)

        strerr := fmt.Sprintf("Failed to provision volume with StorageClass %q: %v", storageClass.Name, err)
        klog.V(2).Infof("failed to provision volume for claim %q with StorageClass %q: %v", claimToClaimKey(claim), storageClass.Name, err)
        ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
        return pluginName, err
    }

But there is a solution in another repo, /kubernetes-sigs/aws-ebs-csi-driver但是在另一个 repo 中有一个解决方案, /kubernetes-sigs/aws-ebs-csi-driver

the issue was resolved after fixing a misconfigured CNI setup, which prevented inter-node-communication and thus a provisioning of storage never got triggered.该问题在修复错误配置的 CNI 设置后得到解决,该设置阻止了节点间通信,因此从未触发存储配置。

We have not tried upgrading our current working cluster (v1.15.x) to any newer versions, but we can confirm that mounting volumes and provisioning storage works on v1.17.x when starting from scratch (aka. building a new test-cluster in our case).我们还没有尝试将我们当前的工作集群 (v1.15.x) 升级到任何更新的版本,但是我们可以确认从头开始时挂载卷和配置存储在 v1.17.x 上工作(也就是构建一个新的测试-在我们的例子中是集群)。

we are using the specs provided above by @gini-schorsch - but since opening this issue we also moved to the external AWS cloud-controller-manager (aka. aws-cloud-controller-manager )我们正在使用@gini-schorsch上面提供的规范 - 但自从打开这个问题我们也转移到了外部 AWS 云控制器管理器(又名aws-cloud-controller-manager

we have been using the provided IAM profiles for both components (CSI and CCM) and cut them down to the use-cases we require for our operations and did not see any problems with that so far.我们一直在为两个组件(CSI 和 CCM)使用提供的 IAM 配置文件,并将它们缩减为我们操作所需的用例,到目前为止没有发现任何问题。

So, check you connectivity.因此,请检查您的连通性。 And maybe @muni-kumar-gundu is right.也许@muni-kumar-gundu 是对的。 And then you may want to check AZ's of your nodes.然后您可能需要检查节点的可用区。

check if the the aws-ebs-csi-driver is running or not检查 aws-ebs-csi-driver 是否正在运行

 kubectl get deployment -n kube-system NAME READY UP-TO-DATE AVAILABLE AGE coredns 2/2 2 2 14d ebs-csi-controller 2/2 2 2 53m

if not then add this service in to you EKS cluster https://docs.aws.amazon.com/eks/latest/userguide/managing-ebs-csi.html如果没有,则将此服务添加到您的 EKS 集群https://docs.aws.amazon.com/eks/latest/userguide/managing-ebs-csi.html

Don't forgot to add AmazonEBSCSIDriverPolicy in your NodeRole.不要忘记在您的 NodeRole 中添加AmazonEBSCSIDriverPolicy

And don't forgot to thanks me:D别忘了感谢我:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkins突然开始未能在Amazon EKS中配置代理 - Jenkins suddenly started failing to provision agents in Amazon EKS Kubectl apply 无法创建 EBS 卷持久卷声明 - Kubectl apply failing to create EBS volume persistent volume claim 如何在 EKS 上的存储 class 中使用卷 gp3? - How to use volume gp3 in storage class on EKS? 是否可以使用 AWS EFS 访问点在 EKS 中安装 kubernetes 持久卷? - Is it possible to use AWS EFS access points to mount a kubernetes persistent volume in EKS? 无法使用 Kubernetes 中的默认存储 class 在 AWS 上创建持久卷 - Unable to create persistent volume on AWS using the default storage class in Kubernetes AWS EKS 上的 HostPath 卷 - HostPath volume on AWS EKS 无法在配置了 Fargate 的 EKS 集群中预配 Pod - Unable to provision Pod in EKS cluster configured with Fargate PVC 的 EKS 卷快照失败 - EKS volumesnapshot failing for PVC 使用路径在 EKS 中创建持久性卷 - creating persistence volume in EKS with path 我们有一个在 AWS 上运行的基于 kops 的 k8s 集群,使用 EFS 作为持久卷进行部署; 现在我们将使用 PVC 部署迁移到 EKS - We have a kops based k8s cluster running on AWS with deployments using EFS as Persistent Volume; Now we would to migrate to EKS with PVC Deployments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM