tws*_*uza 5 amazon-web-services terraform terraform-provider-aws amazon-eks
我正在尝试将 EKS 节点设置为使用 gp3 作为卷。它使用默认的 gp2,但我想将其更改为 gp3。我正在使用 terraform 来构建基础设施和aws_eks_cluster
资源(我没有使用module "eks"
)。这是一个简单的片段:
resource "aws_eks_cluster" "cluster" {
name = var.name
role_arn = aws_iam_role.cluster.arn
version = var.k8s_version
}
resource "aws_eks_node_group" "cluster" {
capacity_type = var.node_capacity_type
cluster_name = aws_eks_cluster.cluster.name
disk_size = random_id.node_group.keepers.node_disk
instance_types = split(",", random_id.node_group.keepers.node_type)
node_group_name = "${var.name}-${local.availability_zones[count.index]}-${random_id.node_group.hex}"
node_role_arn = random_id.node_group.keepers.role_arn
subnet_ids = [var.private ? aws_subnet.private[count.index].id : aws_subnet.public[count.index].id]
version = var.k8s_version
}
Run Code Online (Sandbox Code Playgroud)
我尝试设置kubernetes_storage_class
资源,但它仅针对 Pod 使用的卷 (PV/PVC) 进行更改。我想将节点卷更改为 gp3。
我没有在文档和 github 中找到如何做到这一点。有人能做到吗?
谢谢。
小智 6
您可以尝试设置自己的启动模板,然后在aws_eks_node_group
- launch_template参数中引用它。
启动模板允许您配置磁盘类型。AWS 提供了有关如何正确编写启动模板的指南。