I am trying to get the POST and GET requests working (via Postman) but this is what I'm getting,
GET Request
curl -X GET http://localhost:8080/api/v1/namespaces/default/pods/mypod/exec
GET Response
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "the server could not find the requested resource",
"reason": "NotFound",
"details": {
},
"code": 404
}
POST Request
curl -X POST 'http://localhost:8080/api/v1/namespaces/default/pods/mypod/exec?command=ls&container=my-container&stderr=true&stdout=true'
POST Response
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "Upgrade request required",
"reason": "BadRequest",
"code": 400
}
Any idea on how to get these requests working? What parameters need to be changed?
Thanks
I think you are trying to exec into a pod. A websocket connection is required if you want to exec into a pod.
For a websocket connection, an http(s) call is made first, followed by an upgrade request to websocket using the HTTP Upgrade header.
curl does not support upgrade from http to websocket. Hence the error.
kubectl exec would be handy for this use case.
You can also try other cli tools which support websockets, like
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With