简体   繁体   English

无法将 AI model 部署到 Kubernetes

[英]Unable to deploy AI model to Kubernetes

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.我遵循了一个在线教程,该教程使用 Docker 桌面在本地部署了 model。 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).我在每个容器中安装了 Tensorflow 以运行 AI model(在 Dockerfile 中运行 pip3 install tensorflow)。 However, I can't deploy it on Kubernetes.但是,我无法在 Kubernetes 上部署它。 I hecked the option which allowed Docker Stacks to be sent to Kubernetes.我选择了允许将 Docker 堆栈发送到 Kubernetes 的选项。 I can see both frontend and backend images when I run docker images .当我运行docker images时,我可以看到前端和后端图像。 The next step that I did was that I created a GCP project and created cluster in it.我所做的下一步是创建一个 GCP 项目并在其中创建集群。 Then I pushed these images after tagging them in the specific format gcr.io/project/name:tag to both front end and back end.然后我将这些图像以特定格式gcr.io/project/name:tag标记后推送到前端和后端。 Then I deployed both and then exposed them as well as fdep (frontend) and bdep (backend).然后我部署了两者,然后公开了它们以及 fdep(前端)和 bdep(后端)。 Both of them are running correctly as seen here: [![enter image description here][1]][1]如下所示,它们都运行正常:[![在此处输入图像描述][1]][1]

However, when I go to front end external ip and run the model, nothing happens.但是,当我将 go 连接到前端外部 ip 并运行 model 时,什么也没有发生。 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]这是我使用 postman 在后端外部 IP 上发布请求时得到的结果:[![在此处输入图像描述][2]][2]

Any help here.这里有任何帮助。 What am I doing wrong?我究竟做错了什么?

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,由于这个多容器 docker 应用程序最初不是为 kubernetes 开发的,因此请确保在为后端生成服务时指定名称,

kubectl expose deployment bdep --port 8081 --name (name-that-the-front-end-apps-expect) kubectl 暴露部署 bdep --port 8081 --name (name-that-the-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".在您的情况下,如果没有选项 --name,服务名称默认为部署名称“bdep”,但前端应用程序需要名称“后端”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM