External IP column is empty in the kubectl get services result set

4/19/2016

I have created the service with the following config file:

{
   "kind":"Service",
   "apiVersion":"v1",
   "metadata":{
      "name":"my-service",
      "labels":{
         "app":"my-service"
      }
   },
   "spec":{
      "ports": [
         {
           "port":8080,
           "targetPort":"http-server"
         }
      ],
      "selector":{
         "app":"my-service"
      },
      "type": "LoadBalancer"
   }
}

Executed the following command:

$ kubectl create -f my-service.json

            service "my-service" created

Then I want to see the external address of the service:

$ kubectl get services
NAME             CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
my-service   10.0.203.169                 8080/TCP   3m
kubernetes       10.0.0.1       <none>        443/TCP    32m

In the examples of kubernetes apps it says there should be an "External IP" column, which is set:

$ kubectl get services
NAME              CLUSTER_IP       EXTERNAL_IP       PORT(S)       SELECTOR               AGE
guestbook         10.0.217.218     146.148.81.8      3000/TCP      app=guestbook          1h
redis-master      10.0.136.3       <none>            6379/TCP      app=redis,role=master  1h
redis-slave       10.0.21.92       <none>            6379/TCP      app-redis,role=slave   1h
...

kubectl events shows no information about the load balancer and service.

What might be the problem?

I am using AWS if it helps.

Btw. If I look at the AWS console I can see the DNS name of the Load Balancer and connect to it.

-- experimenter
amazon-web-services
ip
kubernetes

2 Answers

4/19/2016

If your output doesn't look like the example output, then you are most likely using an older version of kubectl (the human friendly output changes over time to become more human friendly). Check your version of kubectl and grab a newer one if it isn't up to date (1.2.0 or newer).

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"5cb86ee022267586db386f62781338b0483733b3", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.2", GitCommit:"528f879e7d3790ea4287687ef0ab3f2a01cc2718", GitTreeState:"clean"}
-- Robert Bailey
Source: StackOverflow

4/19/2016

It can take a few minutes for the external IP to show up because it takes a while for the cloud provider (EC2 in this case) to provision a load balancer for you.

On the off chance that it doesn't show up after a few minutes, run kubectl get events to see what's going wrong.

-- Alex Robinson
Source: StackOverflow