connect api rancher by CLI

I’m trying to connect to the rancher’s api because I want to make a CLI to view my cluster and pods (their status) but all attempts I made from unauthorized even passing the token, is it possible to do this CLI? Can someone give me an example, or if I can even connect it to the rancher’s api

I am a newbie myself at using the API, but this is an example that at least gives me data back.

curl -X GET -H “Authorization: Bearer token-xxx:yyyyy” https://rancher-test.fqdn/v3/clusters/c-dgcsk

So far I have yet to PUT or POST anything.

Note, I have had no luck with a token limited to anything, only the global access one seem to work. I hope that helps somewhat.

1 Like

Using the Rancher Command Line Interface seems like your easiest, but you can poke through Rancher Docs: API too if you need something past that.

1 Like