Cannot make Pod to Service/Pod call in Kubernetes

Posted December 30, 2020 345 views
KubernetesDigitalOcean Managed Kubernetes

I already set up an Kuberentes Service example-service (“example” is a substitution of the real name of my website), and then use an Ingress and the Cert Manager to expose it to the internet. If I visit it’s working perfectly. So the example-service should be already working fine.

And then I try to make some Pod to Service calls in order to allow us to do microservices in the following days.

So I connect to a shell in a Pod in the same namespace and run wget http://example-service.default.svc.cluster.local, but it will always timeout.

I also tried to call Pod directly instead of the Service: wget http://example-pod-0x9012j.default.svc.cluster.local times out too.

I also tried wget http://non-exist-service.default.svc.cluster.local and it returns “Name or service not known” error immediately, so it seems the DNS lookup in the previous command is working.

I go back to Minikube and try the same thing out and it works. Is there any extra work to make Pod to Service/Pod working in DigitalOcean Kubernetes?

Thanks in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Just out of curiosity, do either of these two commands work:

  • Hi Nabsul,

    Thank you so much for your response! I tried this but it doesn’t work.

    But I tried to go over everything today, and find it’s a NetworkPolicy that accidentally selected the Pod and deny incoming traffic.

    Thank you anyway!