Kubernetes/DNS

From Omnia
Revision as of 06:24, 16 December 2024 by Kenneth (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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