Hi I have created a deployment for 2 pods within a worker node and both of them have started successfully.
Pod A’s IP Address: 10.42.21.54
Pod B’s IP Address: 10.42.21.55
I would like to have Pod B communicating with Pod A but since the IP assigned to Pod A (10.42.21.54) is not static, I can only do so via a hostname and letting a DNS resolve it.
Based on this article, the DNS record is created automatically and I should be able to access Pod A via 10-42-21-54.default.pod.cluster.local. However, this did not work when I tried pinging from Pod B’s shell. Also this approach would still require me to know Pod A’s IP beforehand.
I have tried to create a hostname in Pod A’s deployment and pinging it from Pod B (pod-a-hostname.default.pod.cluster.local) but it did not work as well. I suspect that my pods have some issues related to the DNS and hence was unable to reach any other pods within the same cluster. How can I go about fixing this issue?