Using an terraform-created eks cluster. I am using the aws-eks-terraform module. When specifying the aws-ebs-csi-driver as a cluster add-addon, I get
cluster_addons = {
coredns = {
addon_version = "v1.8.7-eksbuild.3"
resolve_conflicts = "OVERWRITE"
}
kube-proxy = {
addon_version = "v1.24.7-eksbuild.2"
resolve_conflicts = "OVERWRITE"
}
vpc-cni = {
addon_version = "v1.12.0-eksbuild.1"
resolve_conflicts = "OVERWRITE"
}
aws-ebs-csi-driver = {
addon_version = "v1.13.0-eksbuild.2"
resolve_conflicts="PRESERVE"
}
}
aws_eks_addon.this["aws-ebs-csi-driver"]: Modifying... [id=it-tooling-eks-8fmuw5:aws-ebs-csi-driver]
╷
│ Error: error updating EKS Add-On (it-tooling-eks-8fmuw5:aws-ebs-csi-driver): InvalidParameter: 1 validation error(s) found.
│ - minimum field size of 1, UpdateAddonInput.ServiceAccountRoleArn.
5
Answers
Short answer is use this:
You need the role, and associated policy for things to work properly. I am including terragrunt scripts (terragrunt=terraform wrapper that uses terraform modules), in the hope that this helps someone.
ROLE
Policy
Friedrich’s answer is correct. Here’s mine but without terragrunt:
And for the EKS module:
Adrian’s answer is almost complete except that it’s still needed explicitly declare
aws_caller_identity
somewhere before usingservice_account_role_arn
passing.here as answer given by Adrian’s, my doubt is here the :role/${var.cluster_name}-ebs-csi-controller do we need to create this role fisrt
There’s two pieces you need to get the EBS CSI driver working:
For the driver install, there’s a helm chart and an add-on. The add-on is much easier to set up.
The terraform-aws-modules organization has terraform modules available that make it very easy to set up.
The
iam-role-for-service-accounts-eks
module will configure the IAM Role exactly as you need in a very clean way.With the role set up, you just need to pass the ARN to the add-on.