Rancher API - anyone use to manage kubernetes?


#1

Does anyone here use Rancher and its API to manage kubernetes?

I have two curl(s) here, one to get info and one to manage. But returning nothing.
Please take a look.
Thanks in advance.

curl -u “token-4444:333”
-X POST
-H ‘Content-Type: application/json’
-d ‘{
“remove”: false,
“timeout”: 0
}’ ‘https//rancher.dev.com/v3/projects/e355944-1ec5-11e9-a8a4-0050a22g5e/containers’

curl -s -u “token-4444:333” -X Get
-H ‘Accept: application/json’
-H ‘Content-Type: application/json’
“https//rancher.dev.com/v3/containers/${CONTAINER_ID}”


#2

This the command I use to export the logs and put them on a different server:

curl -ks -u “token-4dh8g:token-string” -H ‘Accept: application/json’ -H ‘Content-Type: application/json’ “https://[url}/k8s/clusters/c-n822f/api/v1/namespaces/{namespace}/pods/” | grep selfLink | grep {app-nams}| cut -c 59- | cut -c -24 | xargs -I{} curl -ks -u “token-4dh8g:token-string” -H ‘Accept: application/json’ -H ‘Content-Type: application/json’ “https://{URL}/k8s/clusters/c-n822f/api/v1/namespaces/{namespace}/pods/{}/log” -o “/{directory}/new_logs/log_{}.log”

NB: Make sure you replace anything inside of {} with your own details.