<p>DNS resolution looks fine, but I cannot ping my service. What could be the reason?</p>

<p>From another pod in the cluster:</p>

<pre><code>$ ping backend
PING backend.default.svc.cluster.local (10.233.14.157) 56(84) bytes of data.


^C
--- backend.default.svc.cluster.local ping statistics ---
36 packets transmitted, 0 received, 100% packet loss, time 35816ms
</code></pre>

<p>EDIT:</p>

<p>The service definition:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: backend
  name: backend
spec:
  ports:
  - name: api
    protocol: TCP
    port: 10000
  selector:
    app: backend
</code></pre>

<p>The deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  labels:
    app: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      run: backend
  replicas: 1
  template:
    metadata:
      labels:
        run: backend
    spec:
      containers:
      - name: backend
        image: nha/backend:latest
        imagePullPolicy: Always
        ports:
        - name: api
          containerPort: 10000
</code></pre>

<p>I can <code>curl</code> my service from the same container:</p>

<pre><code>kubectl exec -it backend-7f67c8cbd8-mf894 -- /bin/bash
root@backend-7f67c8cbd8-mf894:/# curl localhost:10000/my-endpoint
{"ok": "true"}
</code></pre>

<p>It looks like the endpoint on port <code>10000</code> does not get exposed though:</p>

<pre><code> kubectl get ep
NAME         ENDPOINTS                                                       AGE
backend      &lt;none&gt;                                                          2h
</code></pre>

nha
<p>Ping doesn't work with service's cluster IPs like 10.233.14.157, as it is a virtual IP. You should be able to ping a specific pod, but no a service.</p>
