Unable to deploy AI model to Kubernetes

4/25/2020

I am a relatively seasoned AI practitioner however, I am a complete newbie when it comes to deployment of these models. I followed an online tutorial that deployed the model locally using Docker Desktop. It created a stack of containers for frontend and backend. I installed Tensorflow in each of these containers to run the AI model (RUN pip3 install tensorflow in the Dockerfile). However, I can't deploy it on Kubernetes. I hecked the option which allowed Docker Stacks to be sent to Kubernetes. I can see both frontend and backend images when I run docker images. The next step that I did was that I created a GCP project and created cluster in it. Then I pushed these images after tagging them in the specific format gcr.io/project/name:tag to both front end and back end. Then I deployed both and then exposed them as well as fdep (frontend) and bdep (backend). Both of them are running correctly as seen here: [![enter image description here][1]][1]

However, when I go to front end external ip and run the model, nothing happens. As if the back end is not outputting anything. Here is what I get when I use postman to post a request on backend external IP: [![enter image description here][2]][2]

Any help here. What am I doing wrong?

-- Muhammad Aleem
artificial-intelligence
deployment
docker
google-cloud-platform
kubernetes

1 Answer

4/25/2020

Since this multi-container docker app that was not originally developed for kubernetes, make sure specify a name when generating the service for your backend,

kubectl expose deployment bdep --port 8081 --name (name-that-the-front-end-apps-expect)

In your case, without the option --name, the service name defaults to the deployment name "bdep", but the front end apps are expecting the name "backend".

-- Perryn Gordon
Source: StackOverflow