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:       <none>
Selector:          name=busybox
Type:              ClusterIP
IP:                10.109.13.10
Port:              <unset>  9000/TCP
TargetPort:        9000/TCP
Endpoints:         172.17.0.6:9000
Session Affinity:  None
Events:            <none>

$ 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 <tim@scalefactory.com>

* Update content/en/docs/concepts/services-networking/dns-pod-service.md

Co-authored-by: Tim Bannister <tim@scalefactory.com>

Co-authored-by: Tim Bannister <tim@scalefactory.com>
This commit is contained in:
Eric Pederson 2020-08-01 18:39:41 -04:00 committed by GitHub
parent dcd9374466
commit 19a8bbc82b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -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/)