13

I'm dynamically provisioning a EBS Volume (Kubernetes on AWS through EKS) through PersistentVolumeClaim with a StorageClass

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

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

And pod that uses the volume:

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.

Documentation mentions nothing about tagging for provisioner aws-ebs, storageclass or PVC. I've spent hours to try to add a tag to the dynamically provided EBS volume but not luck.

Is creating custom tags for EBS a possibility in this scenario and if it is how can it be achieved?

Thank you,

Greg

4

2 回答 2

9

似乎在这个时间点上还不可能。

找到了这些:

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

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

希望很快会有所作为。

于 2018-08-31T15:20:12.063 回答
1

当前的方法是使用 AWS EBS CSI 驱动程序而不是 K8s intree 预置器:https ://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html

如果您使用这个新的供应商,您可以使用这个添加新标签:https ://github.com/kubernetes-sigs/aws-ebs-csi-driver/blob/e175fe64989019e2d8f77f5a5399bad1dfd64e6b/charts/aws-ebs-csi-driver/values .yaml#L79

于 2021-06-28T14:55:20.790 回答