Access pods by hostnames

Hi I am trying to get 2 pods within the same nodes to communicate with each other via their hostnames. Following this guide, I have tried a few approaches and here are the results:

Pod A: 10.42.0.11
Pod B: 10.42.0.12

Pod A ping Pod B via default DNS name (10-42-0-12.default.pod.cluster.local) → Works
Pod A ping Pod A hostname and subdomain (eg, pod-a-hostname.subdomain.default.pod.cluster.local) → Works
Pod A ping Pod B hostname and subdomain (eg, pod-b-hostname.subdomain.default.pod.cluster.local) → Does not work

May I know how can I setup a DNS name that allows Pod A and B to communicate with each other without knowing each other’s IP.

Does DNS for Services and Pods | Kubernetes help? I’m not sure where the subdomain is coming from, but I’d think if default is the namespace for the pods then I’d think they should work if you get rid of the subdomain. Additionally, if they’re in the same namespace then just going by name is supposed to work, but you might need to open a shell in the pods and verify their resolv.conf files for their search criteria and that they’ve properly got the coreDNS pod set as their DNS.