簡體   English   中英

使用 Docker 圖像在 Kube.netes 中部署服務時卡在“使用 pid: 7 啟動工作程序”,這里似乎有什么問題?

[英]Stuck on "Booting worker with pid: 7" while deploying a service in Kubernetes using Docker image, What seems to be the problem here?

所以基本上我正在嘗試使用 DockerFile 在 Kube.netes 集群中部署服務,經過這么多次嘗試我仍然遇到相同的錯誤消息Booting worker with pid: 7 on loop,沒有任何退出代碼即

[2023-01-11 09:22:48 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2023-01-11 09:22:48 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2023-01-11 09:22:48 +0000] [1] [INFO] Using worker: gthread
[2023-01-11 09:22:48 +0000] [7] [INFO] Booting worker with pid: 7

這是我的 Docker 圖片:

FROM python:3.10-slim

ENV PYTHONUNBUFFERED True

ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./

RUN pip install --no-cache-dir -r requirements.txt

CMD exec gunicorn --bind 0.0.0.0:8080 --workers 1 --threads 8 --timeout 0 main:app

我真的不知道我哪里錯了,任何線索都會非常有幫助..!!

嘗試以下可能的解決方案:

一)內存問題:

1)嘗試在容器下添加更多資源(請求和限制)——可能需要更多 memory。

2)嘗試增加 docker 容器的可用 RAM 量,請參閱SO了解更多信息並Clear the Cache :登錄backend容器的控制台,然后發出命令bench --site SITE_NAME clear-cache

II)從 Gunicorn 方面:

1) AsyncIO Workers worker gthread是一個線程化的worker。 它在主循環中接受連接,接受的連接作為連接作業添加到線程池中。 在 keepalive 上,連接被放回循環中等待事件。 如果在保持活動超時后沒有事件發生,連接將關閉。

2) To use the inotify reloader, you must have the inotify package installed. 請檢查Gunicorn 設置調試以獲取更多信息。

3)使用configmap創建一個Gunicorn配置文件並將其掛載到web pod。 確保bind是通過配置文件傳遞的,而不是通過args傳遞的。 請 go 通過為 python flask 應用編寫 Kube.netes 清單以獲取更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM