我正在嘗試從 CronJob 到 OpenShift 中的另一個部署做一個簡單的 http-post-request。Get-Requests 作業得很好,但我不知道如何調整 curl-command 來執行 http-post。對于獲取請求,我使用了這個: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
感謝您的任何想法和幫助!
uj5u.com熱心網友回復:
作為解決方案,我只使用另一個影像。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
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/455946.html
