Kubernetes/DNS: Difference between revisions
Jump to navigation
Jump to search
(Created page with "/etc/resolv.conf search kenneth.svc.cluster.local svc.cluster.local cluster.local EXAMPLE.com nameserver 172.30.0.10 options ndots:5") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
== DNS Pod Service == | |||
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/ | |||
Any Pods exposed by a Service have the following DNS resolution available: | |||
pod-ipv4-address.service-name.my-namespace.svc.cluster-domain.example. | |||
Pod's hostname and subdomain fields <ref>https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-hostname-and-subdomain-fields</ref> | |||
* Currently when a Pod is created, its hostname (as observed from within the Pod) is the Pod's metadata.name value. | |||
* The Pod spec also has an optional subdomain field which can be used to indicate that the pod is part of sub-group of the namespace. For example, a Pod with spec.hostname set to "foo", and spec.subdomain set to "bar", in namespace "my-namespace", will have its hostname set to "foo" and its fully qualified domain name (FQDN) set to "foo.bar.my-namespace.svc.cluster.local" (once more, as observed from within the Pod). | |||
servicename.namespace.svc.cluster.local | |||
== Example resolv.conf == | |||
ubuntu pod in namespace kenneth: | |||
/etc/resolv.conf | /etc/resolv.conf | ||
search kenneth.svc.cluster.local svc.cluster.local cluster.local EXAMPLE.com | search kenneth.svc.cluster.local svc.cluster.local cluster.local EXAMPLE.com | ||
nameserver 172.30.0.10 | nameserver 172.30.0.10 | ||
options ndots:5 | options ndots:5 |
Latest revision as of 06:24, 16 December 2024
DNS Pod Service
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
Any Pods exposed by a Service have the following DNS resolution available:
pod-ipv4-address.service-name.my-namespace.svc.cluster-domain.example.
Pod's hostname and subdomain fields [1]
- Currently when a Pod is created, its hostname (as observed from within the Pod) is the Pod's metadata.name value.
- The Pod spec also has an optional subdomain field which can be used to indicate that the pod is part of sub-group of the namespace. For example, a Pod with spec.hostname set to "foo", and spec.subdomain set to "bar", in namespace "my-namespace", will have its hostname set to "foo" and its fully qualified domain name (FQDN) set to "foo.bar.my-namespace.svc.cluster.local" (once more, as observed from within the Pod).
servicename.namespace.svc.cluster.local
Example resolv.conf
ubuntu pod in namespace kenneth: /etc/resolv.conf
search kenneth.svc.cluster.local svc.cluster.local cluster.local EXAMPLE.com nameserver 172.30.0.10 options ndots:5