我知道k8具有带有httpGet方法的readynessProbe来检查服务是否准备好工作。
是否有类似httpPost方法的内容,以便通过某些正文向/ api / postService运行POST请求并检查返回代码?
或者在yaml文件中使用一些棘手的方法。
最佳答案
可以通过将curl作为exec ReadinessProbe运行来完成:
readinessProbe:
exec:
command:
- "curl"
- "-X POST"
- "-f"
- "http://localhost/api/postService"
当然,您需要确保在打包服务的Docker镜像中安装curl。
关于post - 在k8s中是否有类似httpPost的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55949932/