cat >> /etc/host
is source of truth for small environment
cat /etc/resolve.conf
-> dns-name-server 192.168.1.100
: the dns server is at .1.100 ipcat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns <-- l to r order
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
/etc/resolve.conf
can be used to add server name that host doesn’t know about. But if the server is a popular one, entry should be added to centralized DNS serverWe are given a server dedicated as the DNS server, and a set of Ips to configure as entries in the server. There are many DNS server solutions out there, we will focus on a particular one – CoreDNS
/etc/hosts
fileweb-service
is name of the service, apps
is the namespace, all services are grouped together into a subdomain called svc
. Finally all svc and pods are grouped together under cluster.local
–> web-service.apps.svc.cluster.local
.
with -
pod
->10-244-2-5.apps.pod.cluster.local
/etc/resovl.conf
: includes entry points to the central DNS’s serverkube-system
ns./coredns
executable, requires a config file /etc/coredns/Corefile
kubernetes
: where top level’s domain name is setpods insecure
: enable pod’s name resolution, which is often disabled by default.proxy
/etc/coredns/Corefile
is passed into coredns pod as a configmap
kube-dns
kube-dns
service is configured as the name-server
on podname-server
. clusterDNS
and clusterDomain
fields are configured in the kubelet’s config file (in the picture)
[!Note]
resolve.conf
has some defaultsearch
field to help setting default domain. This only helps with services, pods need to use the full FQDN(Full Qualified Domain Name)
web-service
would resolve to web-service.default.svc.cluster.local