【发布时间】:2021-04-11 22:11:04
【问题描述】:
我正在尝试在私有子网中创建 EKS 集群。我在让它工作时遇到问题。我收到错误unhealthy nodes in the kubernetes cluster。不知道是因为安全组还是其他一些问题(如 VPC 端点)?
当我使用 NAT 网关设置时,它工作正常。但是我不想再使用nat gateway了。
有人认为我不确定 EKS 集群的子网 ID 是否应该只是私有子网?
在下面的配置中,我同时使用公共子网和私有子网。
resource "aws_eks_cluster" "main" {
name = var.eks_cluster_name
role_arn = aws_iam_role.eks_cluster.arn
vpc_config {
subnet_ids = concat(var.public_subnet_ids, var.private_subnet_ids)
security_group_ids = [aws_security_group.eks_cluster.id, aws_security_group.eks_nodes.id, aws_security_group.external_access.id]
endpoint_private_access = true
endpoint_public_access = false
}
# Ensure that IAM Role permissions are created before and deleted after EKS Cluster handling.
# Otherwise, EKS will not be able to properly delete EKS managed EC2 infrastructure such as Security Groups.
depends_on = [
"aws_iam_role_policy_attachment.aws_eks_cluster_policy",
"aws_iam_role_policy_attachment.aws_eks_service_policy"
]
}
【问题讨论】:
-
您是否有任何 NAT 网关来为私有子网中的节点提供 Internet 访问?
-
没有 nat 网关。我不想使用 Nat 网关,因为它的价格更高。我有一个不同的设置,它有 nat 网关,效果很好。但我想在没有 nat 网关的情况下实现并使用 vpc 端点。
-
使用VPC端点代替nat网关的方法应该是什么?
-
你有没有在没有 NAT 网关的情况下解决过这个问题?
标签: amazon-web-services kubernetes terraform amazon-eks