title: How to get shell using curl post request in kubernetes?
body: <p>I am creating a pod spec using json which when run will give me a shell on the underlying node as shown below.</p>
  <pre><code>overrides=$(cat &lt;&lt;EOF
  {
      &quot;apiVersion&quot;: &quot;v1&quot;,
      &quot;kind&quot;: &quot;Pod&quot;,
      &quot;metadata&quot;: {
        &quot;name&quot;: &quot;admin-shell&quot;
      },
      &quot;spec&quot;: {
        &quot;containers&quot;: [
          {
            &quot;name&quot;: &quot;admin-shell&quot;,
            &quot;securityContext&quot;: {
            &quot;privileged&quot;: true
            },
            &quot;image&quot;: &quot;alpine:latest&quot;,
            &quot;args&quot;: [&quot;chroot&quot;, &quot;/kdet&quot;, &quot;/bin/bash&quot;],
            &quot;stdin&quot;: true,
            &quot;stdinOnce&quot;: true,
            &quot;tty&quot;: true,
            &quot;volumeMounts&quot;: [{
              &quot;name&quot;: &quot;kdet&quot;,
              &quot;mountPath&quot;: &quot;/kdet&quot;
            }]
        }],
        &quot;volumes&quot;: [{
          &quot;name&quot;: &quot;kdet&quot;,
          &quot;hostPath&quot;: {
            &quot;path&quot;: &quot;/&quot;,
            &quot;type&quot;: &quot;Directory&quot;
          }
        }]        
      }
  }
  EOF
  )
  
  kubectl run --image alpine:latest --rm --restart=Never --overrides=&quot;$foo&quot; -ti test
  If you don't see a command prompt, try pressing enter.
  [root@admin-shell /]# exit
  exit
  pod &quot;admin-shell&quot; deleted
  </code></pre>
  <p>However, when I try to launch the pod using curl with the config saved in api.json, the pod is being created, however I don't get the shell as I got in the previous step.</p>
  <pre><code>&gt;curl -k $APISERVER/api/v1/namespaces/default/pods \
  -XPOST -H 'Content-Type: application/json' \
  -d@api.json \
  --header &quot;Authorization: Bearer $TOKEN&quot;
  
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100  2900    0  2250  100   650  13005   3757 --:--:-- --:--:-- --:--:-- 16763
  
  {
    &quot;phase&quot;: &quot;Pending&quot;,
    &quot;qosClass&quot;: &quot;BestEffort&quot;
  }
  </code></pre>
  <p>Can you please help me how can I get the shell using curl?</p>