post - 在k8s中是否有类似httpPost的内容

标签 post kubernetes

我知道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/

相关文章:

docker - GitLab CI runner 无法连接到 kubernetes 中的 unix :///var/run/docker. sock

ssl - Kubernetes 集群证书轮换

docker - Kubernetes - 使用名称而不是 'localhost' 的 pod 内的容器通信?

kubernetes - 后端返回404/422时,GKE基本元素间歇性返回502

javascript - .NET Core 2 端点不会在 POST 上绑定(bind) FromBody 的参数

php - GRANT语句语法问题及php、分配权限

javascript - 将数组元素附加到 FormData 在 Firefox 15 中不起作用

python - Flask,wtforms 回发空表格

php - jQuery $.post() 函数难以不显示结果?

kubernetes - Kafka/Kubernetes 和 Autoscale