beetween pods and services
if tou setup manually you have to create the dns if you do it witrh kubeadm its automatic
so we have a pod name test and pod name web there is no network policy
we create a web service
hostname | ipadress | namespace | type |
---|---|---|---|
test | 10.244.1.5 | default | pod |
web | 10.244.2.5 | web-namespace | svc |
web-service | 10.107.37.188 | web-namespace | pod |
when we create the pod the cni give ip to the pods and the dns auto link the ip to the hostname
so you can join the pods with is hostname
if pods are in different namespace its hostname.namespace to join the pod like a subdomain
the interest of a service is the have a stable ip or dns acces to a pod without now the ip of the pods you can also does laod balancing with service
all enity are group in a root domain
so you can join any service with
hostname.namespace.type.root-domain
for manage pods dns resolution you create a dns manually if you not install with kubeadm
and when you create a pods you had inot de /etc/host a line with the ip of the dns server
the name os this dns is kube-dns its the core dns its a part of the kube-system
all the data is store in a config map
there is a service name as kube-dns that expose the dns to al the cluster
and its the kubelet that now the ip of the dns so it can auto create pod with good configuration