OpenShift 卷曲 POST 请求

发布于 2025-01-17 16:49:49 字数 722 浏览 6 评论 0原文

我正在尝试从 CronJob 到 OpenShift 中的另一个部署执行简单的 http-post-request。 Get-Requests 工作得很好,但我不知道如何调整curl-命令来执行http-post。 对于 get-request 我使用了这个: Openshift cron job curl

我尝试了很多方法。这里有两个清单片段,不起作用

containers:
  - name: my-container
    image: rhel7
    command:
      - curl
      - '-X POST'
      - '-kvs'
      - >-
        http://target-deployment:8080/api/v1/sync/triggerAction

containers:
  - name: my-container
    image: rhel7
    command:
      - curl
      - '-X POST -kvs'
      - >-
        http://target-deployment:8080/api/v1/sync/triggerAction

感谢您的任何想法和帮助!

I'm trying to do a simple http-post-request from a CronJob to another Deployment in OpenShift. Get-Requests work just fine, but I cannot figure out, how to adapt the curl-command to execute a http-post.
For the get-request I used this: Openshift cron job curl

I tried many thins. Here two manifest-snippets, which don't work

containers:
  - name: my-container
    image: rhel7
    command:
      - curl
      - '-X POST'
      - '-kvs'
      - >-
        http://target-deployment:8080/api/v1/sync/triggerAction

.

containers:
  - name: my-container
    image: rhel7
    command:
      - curl
      - '-X POST -kvs'
      - >-
        http://target-deployment:8080/api/v1/sync/triggerAction

Thanks for any ideas and your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清晰传感 2025-01-24 16:49:49

作为解决方案,我只使用另一个图像。 Curl具有官方的Docker Hub图像。
对我有用的代码看起来像:

containers:
   - name: my-container
     image: curlimages/curl:7.82
     command:
       - sh
       - '-c'
     args:
       - >-
         curl -X POST -ks
         http://target-deployment:8080/api/v1/sync/triggerAction

As a solution, I just use another image. Curl has an official docker hub image.
The code, that works for me, looks like:

containers:
   - name: my-container
     image: curlimages/curl:7.82
     command:
       - sh
       - '-c'
     args:
       - >-
         curl -X POST -ks
         http://target-deployment:8080/api/v1/sync/triggerAction
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文