I need to run some commands in a container through Jenkins.
I tried using the kubectl CLI, but it keeps timing out.
I am now trying to use the Rancher API. I’ve tried multiple options but cannot execute my command.
This is the first command I’ve been trying:
curl -X POST "https://myrancher/k8s/clusters/clusterID/api/v1/namespaces/namespacename/pods/podID/exec?container=containername&stdout=true&stdin=true&stderr=true&tty=true" -H "command=powershell some commands" -H "Connection:upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits" -H "Sec-WebSocket-Key: $WebSocketKey" -H "Sec-WebSocket-Protocol: base64.channel.k8s.io" -H "Sec-WebSocket-Version: 13" -H "Accept-Encoding:gzip, deflate, br" -H "Authorization:Bearer $Rancher_Token"
I am getting a weird response:
3SW50ZXJuYWwgZXJyb3Igb2NjdXJyZWQ6IGVycm9yIGV4ZWN1
Any idea what might be happening?