[英]how to set-up liveness and readiness probes for Celery worker pods
I want to set-up liveness and readiness probes for Celery worker pods.我想为 Celery worker pod 设置 liveness 和 readiness 探测器。 Since these worker pods doesn't have a specific port associated to them I am finding it difficult.
由于这些 worker pod 没有与之关联的特定端口,我发现这很困难。 Main Django app nginx server was easier to set-up.
主 Django 应用程序 nginx 服务器更易于设置。
I am very new to k8s so not much familiar to the different ways to do it.我对 k8s 很陌生,所以对不同的方法不太熟悉。
liveness probe for celery worker: This command only works when remote control is enabled. liveness probe for celery worker:此命令仅在启用远程控制时有效。
$ celery inspect ping -d <worker_name> --timeout=<timeout_time>
When a celery worker uses a solo pool, healthcheck waits for the task to finish.当 celery 工作人员使用单独池时,healthcheck 等待任务完成。 In this case, you must increase the timeout waiting for a response.
在这种情况下,您必须增加等待响应的超时时间。
so in yaml:所以在 yaml 中:
livenessProbe:
initialDelaySeconds: 45
periodSeconds: 60
timeoutSeconds: <timeout_time>
exec:
command:
- "/bin/bash"
- "-c"
- "celery inspect ping -d <worker_name> | grep -q OK"
Of course you have to change the worker name and timeout to your own values当然,您必须将工作人员名称和超时更改为您自己的值
Basically, configuration files in YAML for Celery liveness and readiness probes can be set up in a general way as described in Kube.netes docs .基本上,YAML 中用于 Celery 活性和就绪探测器的配置文件可以按照 Kube.netes 文档中所述的一般方式进行设置。 You can specifically adjust them for Celery pods based on your requirements, for example :
您可以根据您的要求专门针对 Celery 个 pod 进行调整, 例如:
livenessProbe:
exec:
# bash is needed to replace the environment variable
command: [
"bash",
"-c",
"celery inspect ping -A apps -d celery@$HOSTNAME"
]
initialDelaySeconds: 30
periodSeconds: 60
timeoutSeconds: 10
There is still ongoing GitHub issue on this matter - other solutions that might be useful for your set-up are described here .关于这个问题,GitHub 问题仍然存在 -此处描述了可能对您的设置有用的其他解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.