1

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.

Jeff Sloyer
  • 4,899
  • 1
  • 24
  • 48
Chris Snow
  • 23,813
  • 35
  • 144
  • 309

5 Answers5

5

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.

chris rosen
  • 161
  • 2
  • Hi, I am using a paid account where I create a default cluster, use all 4 IPs which come by default and provisioned 4 new IPs. However, when I try to deploy my 5th application, it goes to pending state instead of using the newly provisioned IP. Where am I going wrong? – Ayushi Dalmia Feb 02 '18 at 19:48
1

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

kubectl describe svc kubia-http
1

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
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
0

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!

Romeo Kienzler
  • 3,373
  • 3
  • 36
  • 58
0

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

Akki
  • 96
  • 1
  • 7