Kubernetes EKS中的Pods:can';t解析DNS(但可以ping IP)
我有两个EKS集群,在两个不同的AWS帐户中,我可以假设,它们有不同的防火墙(我没有访问权限)。第一个(Dev)没有问题,但是,在相同的配置下,UAT集群吊舱正在努力解析DNS。节点可以解决问题,而且似乎没有问题 1) 平8.8.8.8工程Kubernetes EKS中的Pods:can';t解析DNS(但可以ping IP),kubernetes,amazon-eks,coredns,Kubernetes,Amazon Eks,Coredns,我有两个EKS集群,在两个不同的AWS帐户中,我可以假设,它们有不同的防火墙(我没有访问权限)。第一个(Dev)没有问题,但是,在相同的配置下,UAT集群吊舱正在努力解析DNS。节点可以解决问题,而且似乎没有问题 1) 平8.8.8.8工程 --- 8.8.8.8 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3003ms 2) 我可以ping谷歌(和其他公司)的IP,但不能ping实际的
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
2) 我可以ping谷歌(和其他公司)的IP,但不能ping实际的dns名称
我们的配置:
我不确定问题是某个地方的防火墙、coredns、需要更新的配置还是“愚蠢的错误”。如果您有任何帮助,我们将不胜感激。经过几天的调试,以下是问题所在: 我允许节点之间的所有流量,但
所有流量
是TCP,而不是UDP
它基本上是AWS中的一条线:
在worker nodes SG中,将入站规则从/添加到worker nodes端口53协议DNS(UDP)
如果您使用terraform,它应该如下所示:
resource "aws_security_group_rule" "eks-node-ingress-cluster-dns" {
description = "Allow pods DNS"
from_port = 53
protocol = 17
security_group_id = "${aws_security_group.SG-eks-WorkerNodes.id}"
source_security_group_id = "${aws_security_group.SG-eks-WorkerNodes.id}"
to_port = 53
type = "ingress"
}
请注意,此问题可能以多种形式出现(例如,DNS不解析只是一种可能的情况)。
terraform awk eks
模块公开一个terraform输入,以创建必要的安全组规则,允许这些工作组/节点组间通信:worker\u create\u cluster\u primary\u security\u group\u rules
。更多信息参见本期terraform awk eks
启用输入后,terraform将创建以下安全组规则:
# module.eks.module.eks.aws_security_group_rule.cluster_primary_ingress_workers[0] will be created
+ resource "aws_security_group_rule" "cluster_primary_ingress_workers" {
+ description = "Allow pods running on workers to send communication to cluster primary security group (e.g. Fargate pods)."
+ from_port = 0
+ id = (known after apply)
+ protocol = "-1"
+ security_group_id = "sg-03bb33d3318e4aa03"
+ self = false
+ source_security_group_id = "sg-0fffc4d49a499a1d8"
+ to_port = 65535
+ type = "ingress"
}
# module.eks.module.eks.aws_security_group_rule.workers_ingress_cluster_primary[0] will be created
+ resource "aws_security_group_rule" "workers_ingress_cluster_primary" {
+ description = "Allow pods running on workers to receive communication from cluster primary security group (e.g. Fargate pods)."
+ from_port = 0
+ id = (known after apply)
+ protocol = "-1"
+ security_group_id = "sg-0fffc4d49a499a1d8"
+ self = false
+ source_security_group_id = "sg-03bb33d3318e4aa03"
+ to_port = 65535
+ type = "ingress"
}
在你的例子中有很多变量,你介意分享你的地形脚本吗?不要忘记删除敏感数据。还需要从您的服务中读取yaml,如果您没有,请运行
kubectl get services-o yaml
将其导出并粘贴到您的问题中。很高兴看到使用terraform eks模块的答案。有趣的是,worker\u create\u cluster\u primary\u security\u group\u规则在默认情况下被禁用。如果您希望使用AWS入口控制器并连接到RDS端点,则需要启用该功能和启用irsa功能。