简体   繁体   English

Kubernetes 动态配置的 EBS 卷上的自定义标签

[英]custom tag on EBS volume provisioned dynamically by Kubernetes

I'm dynamically provisioning a EBS Volume (Kubernetes on AWS through EKS) through PersistentVolumeClaim with a StorageClass我正在通过具有 StorageClass 的 PersistentVolumeClaim 动态配置 EBS 卷(AWS 上的 Kubernetes 通过 EKS)

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: k8sebs
parameters:
  encrypted: "false"
  type: gp2
  zones: us-east-1a
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete
volumeBindingMode: Immediate 

PVC below PVC以下

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: testk8sclaim
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: k8sebs
  resources:
    requests:
      storage: 1Gi

And pod that uses the volume:以及使用该卷的 pod:

kind: Pod
apiVersion: v1
metadata:
  name: mypod
spec:
  containers:
    - name: alpine
      image: alpine:3.2
      volumeMounts:
      - mountPath: "/var/k8svol"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: testk8sclaim

I need to tag the EBS volume with a custom tag.我需要使用自定义标签标记 EBS 卷。

Documentation mentions nothing about tagging for provisioner aws-ebs, storageclass or PVC.文档没有提到任何有关为供应商 aws-ebs、storageclass 或 PVC 标记的内容。 I've spent hours to try to add a tag to the dynamically provided EBS volume but not luck.我花了几个小时尝试向动态提供的 EBS 卷添加标签,但没有运气。

Is creating custom tags for EBS a possibility in this scenario and if it is how can it be achieved?在这种情况下是否可以为 EBS 创建自定义标签,如果可以,如何实现?

Thank you,谢谢,

Greg格雷格

Seems like at this point in time is not something possible yet. 在这个时间点似乎还不是可能的事情。

Found these: 发现这些:

https://github.com/kubernetes/kubernetes/pull/49390 https://github.com/kubernetes/kubernetes/pull/49390

https://github.com/kubernetes/kubernetes/issues/50898 https://github.com/kubernetes/kubernetes/issues/50898

Hopefully something will be done soon. 希望很快就会有所作为。

The current approach is to use the AWS EBS CSI Driver instead of the K8s intree provisioner: https://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html当前的方法是使用 AWS EBS CSI 驱动程序而不是 K8s intree 配置器: https ://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html

If you use this new provisioner, you can add new tags using this: https://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/e175fe64989019e2d8f77f5a5399bad1dfd64e6b/charts/aws-ebs-csi-driver/values.yaml#L79如果你使用这个新的配置器,你可以使用这个添加新标签: https : //github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/e175fe64989019e2d8f77f5a5399bad1dfd64e6b/charts/aws-ebs-csi-driver/ .yaml#L79

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM