DNS problem on AWS EKS when running in private subnets

前端 未结 5 1967
自闭症患者
自闭症患者 2021-02-13 12:50

I have an EKS cluster setup in a VPC. The worker nodes are launched in private subnets. I can successfully deploy pods and services.

However, I\'m not able to perform DN

相关标签:
5条回答
  • 2021-02-13 13:34

    To elaborate on the comment from @Daniel, you need:

    1. an ingress rule for UDP port 53
    2. an ingress rule for UDP on ephemeral ports (e.g. 1025–65535)

    I hadn't added (2) and was seeing CoreDNS receiving requests and trying to respond, but the response wasn't getting back to the requester.

    Some tips for others dealing with these kinds of issues, turn on CoreDNS logging by adding the log configuration to the configmap, which I was able to do with kubectl edit configmap -n kube-system coredns. See CoreDNS docs on this https://github.com/coredns/coredns/blob/master/README.md#examples This can help you figure out whether the issue is CoreDNS receiving queries or sending the response back.

    0 讨论(0)
  • 2021-02-13 13:45

    I feel like I have to give this a proper answer because coming upon this question was the answer to 10 straight hours of debugging for me. As @Daniel said in his comment, the issue I found was with my ACL blocking outbound traffic on UDP port 53 which apparently kubernetes uses to resolve DNS records.

    The process was especially confusing for me because one of my pods worked actually worked the entire time since (I think?) it happened to be in the same zone as the kubernetes DNS resolver.

    0 讨论(0)
  • 2021-02-13 13:49

    So I been struggling for a couple of hours i think, lost track of time, with this issue as well.

    Since i am using the default VPC but with the worker nodes inside the private subnet, it wasn't working.

    I went through the amazon-vpc-cni-k8s and found the solution.

    We have to sff the environment variable of the aws-node daemonset AWS_VPC_K8S_CNI_EXTERNALSNAT=true.

    You can either get the new yaml and apply or just fix it through the dashboard. However for it to work you have to restart the worker node instance so the ip route tables are refreshed.

    issue link is here

    thankz

    0 讨论(0)
  • 2021-02-13 13:51

    We had run into a similar issue where DNS resolution times out on some of the pods, but re-creating the pod couple of times resolves the problem. Also its not every pod on a given node showing issues, only some pods.

    It turned out to be due to a bug in version 1.5.4 of Amazon VPC CNI, more details here -- https://github.com/aws/amazon-vpc-cni-k8s/issues/641.

    Quick solution is to revert to the recommended version 1.5.3 - https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html

    0 讨论(0)
  • 2021-02-13 13:52

    Re: AWS EKS Kube Cluster and Route53 internal/private Route53 queries from pods

    Just wanted to post a note on what we needed to do to resolve our issues. Noting that YMMV and everyone has different environments and resolutions, etc.

    Disclaimer: We're using the community terraform eks module to deploy/manage vpcs and the eks clusters. We didn't need to modify any security groups. We are working with multiple clusters, regions, and VPC's.

    ref: Terraform EKS module

    CoreDNS Changes: We have a DNS relay for private internal, so we needed to modify coredns configmap and add in the dns-relay IP address ...

    ec2.internal:53 {
        errors
        cache 30
        forward . 10.1.1.245
    }
    foo.dev.com:53 {
        errors
        cache 30
        forward . 10.1.1.245
    }
    foo.stage.com:53 {
        errors
        cache 30
        forward . 10.1.1.245
    }
    

    ...

    VPC DHCP option sets: Update with the IP of the above relay server if applicable--requires regeneration of the option set as they cannot be modified.

    Our DHCP options set looks like this:

    ["AmazonProvidedDNS", "10.1.1.245", "169.254.169.253"]
    

    ref: AWS DHCP Option Sets

    Route-53 Updates: Associate every route53 zone with the VPC-ID that you need to associate it with (where our kube cluster resides and the pods will make queries from).

    there is also a terraform module for that: https://www.terraform.io/docs/providers/aws/r/route53_zone_association.html

    0 讨论(0)
提交回复
热议问题