【问题标题】:How to use volume gp3 in storage class on EKS?如何在 EKS 的存储类中使用卷 gp3?
【发布时间】:2021-12-01 10:54:35
【问题描述】:

我正在为 EKS 将卷 gp2 转换为卷 gp3,但出现此错误。
无法使用 StorageClass“gp3”预置卷:AWS VolumeType“gp3”无效时间>
这是我的配置。

存储类

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
  name: gp3
parameters:
  fsType: ext4
  type: gp3
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer   

聚氯乙烯

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: test-pvc
  name: test-pvc
  namespace: default
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: gp3   

当我输入kubectl describe pvc/test 时。这是回应:

Name:          test-pvc
Namespace:     default
StorageClass:  gp3
Status:        Pending
Volume:        
Labels:        app=test-pvc
Annotations:   volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Used By:       <none>
Events:
  Type     Reason              Age                  From                         Message
  ----     ------              ----                 ----                         -------
  Warning  ProvisioningFailed  58s (x9 over 4m35s)  persistentvolume-controller  Failed to provision volume with StorageClass "gp3": invalid AWS VolumeType "gp3"   

我使用的是 Kubernetes 1.18 版。
有人能帮我吗。谢谢!

【问题讨论】:

  • 你的问题解决了吗(@gohm'c 的回答对你有帮助吗)?
  • 你能给出你的解决方案吗?谢谢!
  • AWS发布了将EKS从gp2迁移到gp3 EBS卷的说明aws.amazon.com/blogs/containers/…

标签: amazon-web-services kubernetes cloud devops amazon-eks


【解决方案1】:

默认的 k8s 存储驱动程序仅支持 gp2。要使用 gp3,您需要安装 AWS EBS CSI 驱动程序。这里是官方instruction安装驱动。

【讨论】:

    【解决方案2】:

    感谢@gohm'c,但我想补充一点,需要在安装AWS 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
    

    参考:Persistent Storage in EKS failing to provision volume

    【讨论】:

      猜你喜欢
      • 2021-12-29
      • 1970-01-01
      • 2019-12-03
      • 2021-04-12
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 2020-07-22
      相关资源
      最近更新 更多