Flask not working on Kubernetes (GKE) Load balancer IP address

Viewed 30

I have been playing around with deploying a simple Flask app on Kubernetes (GKE).

However, when I go to the LoadBalancer IP address the Flask site is not loading and is throwing the following error: 'Connection refused by the server'

What i have done:

  • Built a simple flask app that runs on port 5000 and deployed it to a docker container on Container Registry
  • I then deployed the app in a pod on GKE with command: kubectl run site --image=gcr.io/<>/site-image-test --port=5000 --env="NAME=Will" -- bin/sh -c 'python3 main.py'
  • Checking the pod logs, the app/pod is running as expected
  • I then created a loadbalancer service with command: kubectl expose pod site --port=8080 --target-port=5000 --type=LoadBalancer
  • The service is listed as running:

...but when I go to the service IP address in my browser the flask page is not loading.

Does anyone know what I might be doing wrong, given that everything seems to be working fine?

UPDATE Including screenshot of service accounts gotten from kubectl:

enter image description here

0 Answers
Related