How to expose kube-dns service for queries outside cluster?
<p>I'm trying to expose the "kube-dns" service to be available to be queried outside of the Kubernetes cluster. In order to do this I edited the "Service" definition to change "type" from "ClusterIP" to "NodePort" which seemed to work fine.</p>

<p>However, when I attempt to query on the node port, I'm able to get a TCP session (testing with Telnet) but can't seem to get any response from the DNS server (testing with dig).</p>

<p>I've had a look through the logs on each of the containers on the "kube-dns" Pod but can't see anything untoward. Additionally, querying the DNS from within the cluster (from a running container) appears to work without any issues.</p>

<p>Has anyone tried to expose the kube-dns service before? If so, are there any additional setup steps or do you have any debugging advice for me?</p>

<p>The service definition is as follows:</p>

<pre><code>$ kubectl get service kube-dns -o yaml --namespace kube-system
apiVersion: v1
kind: Service
metadata:
...
spec:
  clusterIP: 10.0.0.10
  ports:
  - name: dns
    nodePort: 31257
    port: 53
    protocol: UDP
    targetPort: 53
  - name: dns-tcp
    nodePort: 31605
    port: 53
    protocol: TCP
    targetPort: 53
  selector:
    k8s-app: kube-dns
  sessionAffinity: None
  type: NodePort
status:
  loadBalancer: {}
</code></pre>