Kubernetes service external IP address remains pending with IBM Cloud (earlier called as Bluemix)

6.6k views Asked by At

I'm following an example from Kubernetes in Action to run a simple docker image in kubernetes:

$ bx login --apikey @apiKey.json -a  https://api.eu-de.bluemix.net
$ bx cs cluster-config my_kubernetes
$ export KUBECONFIG=..my_kubernetes.yml

Next, run the container:

$ kubectl run kubia --image=luksa/kubia --port=8080 --generator=run/v1
$ kubectl expose rc kubia --type=LoadBalancer --name kubia-http
$ kubectl get service
$ kubectl get svc

NAME         CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
kubernetes   10.10.10.1    <none>        443/TCP          20h
kubia-http   10.10.10.12   <pending>     8080:32373/TCP   0m

Fifteen minutes later ...

NAME         CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
kubernetes   10.10.10.1    <none>        443/TCP          20h
kubia-http   10.10.10.12   <pending>     8080:32373/TCP   15m

I don't have anything else running on the Kubernetes cluster.

5

There are 5 answers

0
Chris Snow On BEST ANSWER

Thanks to Chris Rosen's answer, I was able to find a workaround:

$ bx cs workers my_kubernetes
OK
ID                 Public IP  Private IP  Machine Type State    Status
kube-par01-xxxxx   1.2.3.4    6.7.8.9     free         normal   Ready

Note the Public IP address: 1.2.3.4

Expose the service with NodePort:

$ kubectl expose rc kubia --type=NodePort --name kubia-http2

Check the NodePort details:

$ kubectl get svc
NAME          CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes    10.10.10.1     <none>        443/TCP          21h
kubia-http2   10.10.10.193   <nodes>       8080:31247/TCP   10s

Access the service using the exposed port on the worker Public IP address:

$ curl http://1.2.3.4:31247/
You've hit kubia-bjb59
0
Richard Theis On

Run the following to determine if there are any failure events.

kubectl describe svc kubia-http
1
chris rosen On

To close out the thread here, LoadBalancer cannot be used in a lite (aka free) cluster tier. The differences between lite and standard clusters can be found here - https://console.bluemix.net/docs/containers/cs_planning.html#cs_planning.

0
Akki On

If your purpose is to test your application by having it the accessible to the external world , I would suggest using the NodePort service which can be used in the free tier service.

More Info can be found here : Expose service to world

0
Romeo Kienzler On

Based on the posts above I was getting the following steps to work:

Prerequisites: Create a free Kubernetes cluster in the IBM Cloud and follow the steps (you need to have the ibmcloud and kubectl installed and connect to the remote cluster first)

kubectl get nodes

should return something like this

NAME           STATUS   ROLES    AGE     VERSION
10.76.197.55   Ready    <none>   4h18m   v1.18.10+IKS

Then,

  1. kubectl apply -f https://k8s.io/examples/controllers/replication.yaml

replicationcontroller/nginx created

  1. kubectl expose rc nginx --type=NodePort

service/nginx exposed

  1. kubectl get svc

    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

    nginx NodePort 172.21.19.73 80:30634/TCP 70s

  2. Note down the port, 30634 in my case

  3. kubectl describe nodes |grep ExternalIP (to find out the external IP)

call IP:port

Have fun!