title: AWS EKS CoreDNS issue on public subnet
body: <p>I completed the AWS EKS using their setup steps.</p>
  
  <p>AWS EKS ver 1.11, coredns</p>
  
  <p>With the VPC I create two public and two private subnets according to their docs here: <a href="https://docs.aws.amazon.com/eks/latest/userguide/create-public-private-vpc.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/create-public-private-vpc.html</a></p>
  
  <p>Nodes deployed to a private subnet are labeled private and nodes deployed to a public subnet are labeled public.</p>
  
  <p>When I deploy a busybox pod to each nodeSelector (public/private) the public container cannot resolve dns while the private can.</p>
  
  <p><code>nslookup: can't resolve 'kubernetes.default'</code></p>
  
  <p>If I ssh onto the public subnet node itself I am able to ping hostnames (ie google.com) successfully.</p>
  
  <p>Any thoughts?</p>
  
  <pre><code># kubectl exec -it busybox-private -- nslookup kubernetes.default
  
  Server:    172.20.0.10
  Address 1: 172.20.0.10 ip-172-20-0-10.ec2.internal
  
  Name:      kubernetes.default
  Address 1: 172.20.0.1 ip-172-20-0-1.ec2.internal
  </code></pre>
  
  <pre><code># kubectl exec -it busybox-public -- nslookup kubernetes.default
  Server:    172.20.0.10
  Address 1: 172.20.0.10
  
  nslookup: can't resolve 'kubernetes.default'
  command terminated with exit code 1
  </code></pre>
  
  <pre><code># kubectl -n=kube-system get all
  NAME                           READY     STATUS    RESTARTS   AGE
  pod/aws-node-46626             1/1       Running   0          3h
  pod/aws-node-52rqw             1/1       Running   1          3h
  pod/aws-node-j7n8l             1/1       Running   0          3h
  pod/aws-node-k7kbr             1/1       Running   0          3h
  pod/aws-node-tr8x7             1/1       Running   0          3h
  pod/coredns-7bcbfc4774-5ssnx   1/1       Running   0          20h
  pod/coredns-7bcbfc4774-vxrgs   1/1       Running   0          20h
  pod/kube-proxy-2c7gj           1/1       Running   0          3h
  pod/kube-proxy-5qr9h           1/1       Running   0          3h
  pod/kube-proxy-6r96f           1/1       Running   0          3h
  pod/kube-proxy-9tqxt           1/1       Running   0          3h
  pod/kube-proxy-bhkzx           1/1       Running   0          3h
  
  NAME               TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)         AGE
  service/kube-dns   ClusterIP   172.20.0.10   &lt;none&gt;        53/UDP,53/TCP   20h
  
  NAME                        DESIRED   CURRENT   READY     UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
  daemonset.apps/aws-node     5         5         5         5            5           &lt;none&gt;          20h
  daemonset.apps/kube-proxy   5         5         5         5            5           &lt;none&gt;          20h
  
  NAME                      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
  deployment.apps/coredns   2         2         2            2           20h
  
  NAME                                 DESIRED   CURRENT   READY     AGE
  replicaset.apps/coredns-7bcbfc4774   2         2         2         20h
  </code></pre>
  
  <p>Going through "Debugging DNS Resolution"
  <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/</a></p>
  
  <p>Odd that AWS has their coredns pods still labelled kube-dns</p>
  
  <pre><code># kubectl get pods --namespace=kube-system -l k8s-app=kubedns
  No resources found.
  
  # kubectl get pods --namespace=kube-system -l k8s-app=kube-dns
  NAME                       READY     STATUS    RESTARTS   AGE
  coredns-7bcbfc4774-5ssnx   1/1       Running   0          20h
  coredns-7bcbfc4774-vxrgs   1/1       Running   0          20h
  
  # for p in $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name); do kubectl logs --namespace=kube-system $p; done
  2019/01/31 15:23:36 [INFO] CoreDNS-1.1.3
  2019/01/31 15:23:36 [INFO] linux/amd64, go1.10.5, d47c9319
  .:53
  CoreDNS-1.1.3
  linux/amd64, go1.10.5, d47c9319
  2019/01/31 15:23:36 [INFO] CoreDNS-1.1.3
  2019/01/31 15:23:36 [INFO] linux/amd64, go1.10.5, d47c9319
  .:53
  CoreDNS-1.1.3
  linux/amd64, go1.10.5, d47c9319
  
  </code></pre>