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.
The Rancher CLI is stupidly limited. You can’t really do much with it. But, it’s worth mentioning.
I haven’t tried it yet. Still playing around on other things and my task right now is proof-of-concept & documentation & things of that nature.
However, re-reading the original question, I think a part of an issue might be that I don’t think Rancher itself knows about what’s on the downstream clusters. So I think if you’re trying to look at everything running in downstream, then it’s likely that using Rancher API or CLI to get a list of clusters and kubeconfig files for the clusters and then using kubectl on that list of clusters seems like it might be the way to go for that level of detail & info.