Kubernetes 1.5.2 ping can't find ClusterIP of a Service from inside Cluster

6/27/2017

I have setup a Cluster with some deployments and services.

I can log into any of my pods and ping the pods from their pod network ips ( 172.x.x.x ) and they are successful.

But when I try to ping the services ClusterIP addresses from any of my pods they never respond, so I can't access my services.

Below is my Kibana deployment, and 10.254.77.135 is the IP I am trying to connect to from my other services, I also can't use this node port, it never responds

{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "kibana",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/services/kibana",
    "uid": "21498caf-569c-11e7-a801-0050568fc023",
    "resourceVersion": "3282683",
    "creationTimestamp": "2017-06-21T16:10:23Z",
    "labels": {
      "component": "elk",
      "role": "kibana"
    }
  },
  "spec": {
    "ports": [
      {
        "name": "http",
        "protocol": "TCP",
        "port": 5601,
        "targetPort": 5601,
        "nodePort": 31671
      }
    ],
    "selector": {
      "k8s-app": "kibana"
    },
    "clusterIP": "10.254.77.135",
    "type": "NodePort",
    "sessionAffinity": "None"
  },
  "status": {
    "loadBalancer": {}
  }
}
-- Cristiano Fontes
kubernetes

1 Answer

6/27/2017

Not sure if this is your problem, but apparently ping doesn't work on services ClusterIP addresses because they are virtual addresses created by iptables rules that just redirect packets to the endpoints(pods).

-- rod
Source: StackOverflow