<p>I seem to have an issue with my C# applications that I containerize and put into pod, cant seem to reach services withing the cluster?</p>

<p>I made a simple code example </p>

<pre><code>using System;
using System.Net.NetworkInformation;

namespace pingMe
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Ping ping = new Ping();
            PingReply pingresult = ping.Send("example-service.default.svc");
            if (pingresult.Status.ToString() == "Success")
            {
                Console.WriteLine("I can reach");
            }
        }
    }
}
</code></pre>

<p>which should be able to ping this within the cluster </p>

<pre><code>PS C:\Helm&gt; kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
deployment.apps/hello-world created
PS C:\Helm&gt; kubectl expose deployment hello-world --type=ClusterIP --name=example-service
service/example-service exposed
PS C:\Helm&gt; kubectl get service/example-service
NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
example-service   ClusterIP   10.97.171.216   &lt;none&gt;        8080/TCP   14s
PS C:\Helm&gt; kubectl get deployment.apps/hello-world
NAME          READY   UP-TO-DATE   AVAILABLE   AGE
hello-world   2/2     2            2           61s
</code></pre>

<p>but In the cluster I get this: </p>

<pre><code>Hello World!
Unhandled exception. System.Net.NetworkInformation.PingException: An exception occurred during a Ping request.
 ---&gt; System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
   at System.Net.Dns.InternalGetHostByName(String hostName)
   at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
   at System.Net.NetworkInformation.Ping.GetAddressAndSend(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
   --- End of inner exception stack trace ---
   at System.Net.NetworkInformation.Ping.GetAddressAndSend(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
   at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
   at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress)
   at pingMe.Program.Main(String[] args) in /src/pingMe/Program.cs:line 12
</code></pre>

<p>How come... Adding the port number does not help..</p>

<p>On the surface it all looks OK. I would start debugging by eliminating possibilities. From the "worker" pod can you ping the ClusterIP and not the service name? Can you successfully do a DNS lookup on any service or pod? If you can access the Cluster IP, but pinging or resolving the service name continues to fail then DNS seems more suspect. </p>
