我尝试通过 Terraform 使用 Helm 安装 EFS CSI 驱动程序,但遇到与指定存储库 URL 和图像标签/URI 相关的问题。每当我提供这些值时,我都会收到“超出上下文截止日期”错误。
这是我部署 Helm 图表的 Terraform 代码片段:
resource "helm_release" "test_aws_efs_controller" {
name = "aws-efs-csi-driver"
repository = "https://kubernetes-sigs.github.io/aws-efs-csi-driver/"
chart = "aws-efs-csi-driver"
namespace = "${var.project_name}-${var.environment_name}-microservices"
version = "2.2.0"
set {
name = "clusterName"
value = var.test_ekscluster_id
}
# set {
# name = "image.repository"
# value = "public.ecr.aws/efs-csi-driver/amazon/aws-efs-csi-driver:v1.6.0"
# }
# set {
# name = "image.tag"
# value = "v2.4.8"
# }
set {
name = "controller.serviceAccount.create"
value = true
}
set {
name = "controller.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
value = var.aws_efs_controller_role_arn
}
set {
name = "controller.serviceAccount.name"
value = "${var.project_name}-${var.environment_name}-efs-controller"
}
depends_on = [
var.test_nodegroup,
var.aws_efs_controller_role_attach
]
}
我尝试了存储库和版本字段的各种组合,以及 image.repository 的不同值,但我仍然遇到“超出上下文截止日期”错误。
有人可以提供有关在通过 Terraform 使用 Helm 部署 EFS CSI 驱动程序时用于这些字段的正确值的指导吗?此外,如果需要为此驱动程序设置任何特定的 Helm 图表配置,请告诉我。
基于 Helm 图表 GitHub 存储库中的文档:
要指定图像存储库,请添加以下参数。将存储库地址替换为集群的容器镜像地址。
文档显示的示例是:
--set image.repository=602401143452.dkr.ecr.region-code.amazonaws.com/eks/aws-efs-csi-driver
由于集群运行在孟买(
ap-south-1
)地区,因此需要将代码修复为以下内容:
resource "helm_release" "test_aws_efs_controller" {
name = "aws-efs-csi-driver"
repository = "https://kubernetes-sigs.github.io/aws-efs-csi-driver/"
chart = "aws-efs-csi-driver"
namespace = "${var.project_name}-${var.environment_name}-microservices"
version = "2.4.9"
set {
name = "clusterName"
value = var.test_ekscluster_id
}
set {
name = "image.repository"
value = "602401143452.dkr.ecr.ap-south-1.amazonaws.com"
}
set {
name = "image.tag"
value = "v1.6.0"
}
set {
name = "controller.serviceAccount.create"
value = true
}
set {
name = "controller.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
value = var.aws_efs_controller_role_arn
}
set {
name = "controller.serviceAccount.name"
value = "${var.project_name}-${var.environment_name}-efs-controller"
}
}