Skip to content
Advertisement

URL for IBM Cloud Kubernetes deployment

This is a bit of a beginner’s question. I’m attempting to get a simple Hello World Python flask application deployed in a kubernetes cluster on IBM Cloud. The application (main.py):

JavaScript

I build my Docker image with docker build --rm -t kube-hw . and Dockerfile:

JavaScript

I run it locally with docker run --rm -p 5000:5000 kube-hw. That works fine. I can browse http://0.0.0.0:5000/.

However, when I run the same image on k8s on IBM Cloud I can’t seem to access the URL endpoint. My deployment steps are (from the article mentioned in the answer below):

JavaScript

I then use kubectl describe pod kube-hw to get the external IP address 10.77.223.141:

JavaScript

And kubectl describe service kube-hw to get the port 30930:

JavaScript

The URL http:\10.77.223.141:30930 doesn’t resolve. I can look at the log and see the app running, but no requests are getting to it. The article uses --target-port=8888. But since I’ve used port 5000 in the container I changed to --target-port=5000. I’m wondering if I have a misalignment of port numbers somewhere.

Advertisement

Answer

The IP address that you need is the external IP address of a worker node in your cluster. The IP address that you have identified is an internal address.

To get an external IP address, run bx cs workers <cluster_name>

Then form the URL as follows: http://<external_node_ip>:<NodePort>

Here’s a doc with more information on using NodePort: https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement