From 19a8bbc82b66d70855e6705447433e2ebf16836c Mon Sep 17 00:00:00 2001 From: Eric Pederson Date: Sat, 1 Aug 2020 18:39:41 -0400 Subject: [PATCH] Add non-exposed Pod DNS name (#22797) * Add Pod DNS name I could not get the hostname/subdomain example to work. For example: ``` $ kubectl describe svc busybox1 Name: busybox1 Namespace: default Labels: name=busybox Annotations: Selector: name=busybox Type: ClusterIP IP: 10.109.13.10 Port: 9000/TCP TargetPort: 9000/TCP Endpoints: 172.17.0.6:9000 Session Affinity: None Events: $ kubectl get ep busybox1 NAME ENDPOINTS AGE busybox1 172.17.0.6:9000 4m5s $ kubectl get pod busybox1 -o jsonpath="{.metadata.labels} {.spec.hostname} {.spec.subdomain}" map[name:busybox] busybox-1 default-subdomain $ kubectl exec busybox -- nslookup busybox-1.default-subdomain.default.svc.cluster.local nslookup: can't resolve 'busybox-1.default-subdomain.default.svc.cluster.local' Server: 10.96.0.10 Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local command terminated with exit code 1 ``` * Update content/en/docs/concepts/services-networking/dns-pod-service.md Co-authored-by: Tim Bannister * Update content/en/docs/concepts/services-networking/dns-pod-service.md Co-authored-by: Tim Bannister Co-authored-by: Tim Bannister --- .../services-networking/dns-pod-service.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/content/en/docs/concepts/services-networking/dns-pod-service.md b/content/en/docs/concepts/services-networking/dns-pod-service.md index 9d88019e3c..738c6bac14 100644 --- a/content/en/docs/concepts/services-networking/dns-pod-service.md +++ b/content/en/docs/concepts/services-networking/dns-pod-service.md @@ -68,10 +68,19 @@ of the form `auto-generated-name.my-svc.my-namespace.svc.cluster-domain.example` ### A/AAAA records -Any pods created by a Deployment or DaemonSet have the following -DNS resolution available: +In general a pod has the following DNS resolution: -`pod-ip-address.deployment-name.my-namespace.svc.cluster-domain.example.` +`pod-ip-address.my-namespace.pod.cluster-domain.example`. + +For example, if a pod in the `default` namespace has the IP address 172.17.0.3, +and the domain name for your cluster is `cluster.local`, then the Pod has a DNS name: + +`172-17-0-3.default.pod.cluster.local`. + +Any pods created by a Deployment or DaemonSet exposed by a Service have the +following DNS resolution available: + +`pod-ip-address.deployment-name.my-namespace.svc.cluster-domain.example`. ### Pod's hostname and subdomain fields @@ -276,4 +285,3 @@ The availability of Pod DNS Config and DNS Policy "`None`" is shown as below. For guidance on administering DNS configurations, check [Configure DNS Service](/docs/tasks/administer-cluster/dns-custom-nameservers/) -