This question is relevant to local cluster (kubernetes 1.10+ version, Linux). After creating a StatefulSet to manage several pods, I met a use case that requires setting up FQDN identity for the pods.
For instance, I wish to have the first pod with FQDN identity of <some-statefulset>-0.<some-subdomain>.default.svc.cluster.local
. Desired behavior can be achieved by adding <IP-address> <some-statefulset>-0.<some-subdomain>.default.svc.cluster.local
into /etc/hosts
file, but I want to have the FQDN to be identified automatically in the local cluster without changing the /etc/hosts
file.
Not sure whether I need to enable some settings when starting the local cluster.
By default the cluster.local is the internal domain. To reach service from pods within the cluster,
svc_name.namespace_name.cluster.local