https://rancher.com/ logo
#general
Title
# general
b

best-agency-48985

03/24/2023, 3:42 PM
Hey folks, how do I get access to the Rancher API (preferably just a
GET
) similar to what’s in the Dashboard UI for resources such as
/explorer/networking.k8s.io.ingress
.. I can’t seem to get the ingress information via the documented API endpoints for
/v3/
in a way that’s similar to the ‘Service Discovery’ section of the Dashboard. Is there anyway to access this without using the method for generating the KUBECONFIG from a
POST
for
action=generateKubeconfig
and just querying the k8s API?
Good news, I solved it myself .. you can seemingly get all API endpoints using the following, for example:
Copy code
/k8s/clusters/$CLUSTER_ID/apis/networking.k8s.io/v1/ingresses
This seems to be an undocumented API.
But I am able to use the same Bearer token as for
/v3/
r

rough-farmer-49135

03/24/2023, 5:52 PM
I was typing this up as you solved, but the warning may still be relevant. I'm not 100% sure on this, but last time I saw people chatting about it there was some documentation at https://ranchermanager.docs.rancher.com/pages-for-subheaders/about-the-api but a lot isn't documented because it's not considered published as stable (i.e. they want to reserve the right to change it with no notice still). There also wasn't promised stability for where some of the stuff lived under the Kubernetes API either, as I recall. That was a while ago so maybe it's changed since then.
👍 1
b

best-agency-48985

03/24/2023, 5:52 PM
You can get a list of all available API endpoints by hitting
/k8s/clusters/$CLUSTER_ID/
Ah nice, thank you!
1
8 Views