From 77c05ef4187f5f09a6524d39943d3d9e173c6b91 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Mon, 24 Jul 2017 17:02:12 +0800 Subject: [PATCH] Add dns policy setting --- .../services-networking/dns-pod-service.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/concepts/services-networking/dns-pod-service.md b/docs/concepts/services-networking/dns-pod-service.md index 59750ace51..4a9f817d4c 100644 --- a/docs/concepts/services-networking/dns-pod-service.md +++ b/docs/concepts/services-networking/dns-pod-service.md @@ -234,6 +234,29 @@ nameserver 10.0.0.10 options ndots:5 ``` +### DNS Policy + +By default, DNS policy for a pod is 'ClusterFirst'. So pods running with hostNetwork cannot resolve DNS names. To have DNS options set along with hostNetwork, you should specify DNS policy explicitly to 'ClusterFirstWithHostNet'. Update the busybox.yaml as following: + +```yaml +apiVersion: v1 +kind: Pod +metadata: + name: busybox + namespace: default +spec: + containers: + - image: busybox + command: + - sleep + - "3600" + imagePullPolicy: IfNotPresent + name: busybox + restartPolicy: Always + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet +``` + #### Quick diagnosis Errors such as the following indicate a problem with the kube-dns add-on or associated Services: