Sign inSign up

sergrua/kube-tagger

By sergrua

•Updated over 5 years ago

Tags EBS volumes when the PVC is created

Image
0

100K+

sergrua/kube-tagger repository overview

⁠Kubernetes Volume Tagger

⁠What?

It's a simple pod that checks if AWS EBS volumes created by K8s have the AWS tags required.

⁠How?

On your volume claims add the tags into annotations like:

annotations:
  volume.beta.kubernetes.io/additional-resource-tags: Owner=Sergio,Environment=Dev

Multiple tags are , separated by default but you can override it with:

annotations:
  volume.beta.kubernetes.io/additional-resource-tags-separator: ";"

You may need to grant your EC2 instances permissions to tag volumes. This is the minimal config expected:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ec2:DescribeVolumes",
      "Resource": "*"
     },
     {
       "Effect": "Allow",
       "Action": [
         "ec2:CreateTags"
       ],
       "Resource": "arn:aws:ec2:*:*:volume/*",
       "Condition": {
         "StringEquals": {
             "ec2:CreateAction" : "CreateTags"
        }
      }
    }
  ]
}

⁠Deploy

⁠Manual

See kube-tagger.yaml⁠ for an example deployment.

kubectl apply -f https://raw.githubusercontent.com/sergiorua/kube-tagger/master/kube-tagger.yaml
⁠Helm
helm repo add sergiorua https://sergiorua.github.io/helm-charts/
helm upgrade --install kube-tagger sergiorua/kube-tagger
⁠Values
KeyTypeDefaultDescription
affinityobject{}
extraEnvobject{}
global.namestring"kube-tagger"
global.namespacestring"kube-system"
image.backoffLimitint3
image.containerPortint8080
image.namespacestring"kube-system"
image.pullPolicystring"IfNotPresent"
image.repositorystring"sergrua/kube-tagger"
image.tagstring"release-0.0.9"
nodeSelectorobject{}
podAnnotationsobject{}
rbac.createbooltrue
rbac.pspEnabledboolfalse
replicasint1
resourcesobject{}
serviceAccount.annotationsobject{}
serviceAccount.createbooltrue
tolerationslist[]

Tag summary

Content type

Image

Digest

Size

64.6 MB

Last updated

over 6 years ago

docker pull sergrua/kube-tagger