curlhttp-postopenshiftrhel7

OpenShift curl POST request


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!


Solution

  • 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