Is there a Rancher API to add a node to a cluster?

I’m not finding the Rancher API spec from the help docs - not like a swagger spec or something similar. Is there one?

What I want to do is scale up/down the nodes in my cluster, using the API. I can’t be the only person that wants to do this. I’m assuming that Rancher is doing some work behind the scenes to help create the VM and add it to the K8s cluster as a node.

Please, advise.

+1

Been trying these with no luck

curl -u “token-token-idid:pwpw” -X POST -H ‘Content-Type: application/json’ -d ‘{“remove”: false, “timeout”: 0}’ ‘https//rancher.testdev.com/v3/projects/e4e33944-1ec5-11aadd-a8fda4-00523ac95e/containers’

curl -u “token-token-idid:pwpw” -X POST -H ‘Content-Type: application/json’ -d ‘{“remove”: false, “timeout”: 0}’ ‘https://rancher.test.com/v3/nodes/qs-fgcn:m-9q69w

curl -u “token-token-idid:pwpw” -X POST -H ‘Content-Type: application/json’ -d ‘{“remove”: true, “timeout”: 0}’ ‘https://rancher.test.com/v3/nodes/qs-fgcn:m-9q69w

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

If the cluster was created with a node driver (EC2, DigitalOcean, etc, the lower-left quadrant of the add cluster options) then there are one or more node pools on the cluster which you can edit the scale of. Click view in API on the cluster, then edit and show request. (You can send a partial update of just the top level nodepools field instead of the entire cluster).

Increasing the same will automatically start provisioning a new node. Reducing the scale does not delete nodes automatically, so you need to pick and delete them (and probably cordon & drain it first).

If your cluster was created with “custom”, we have no control over the nodes. You can run the registration command on new nodes to bring then in or delete ones you don’t want anymore.

If your cluster is imported, we have no control at all and are just showing what the nodes are.

If your cluster is a hosted kubernetes provider (top left, AKS/EKS/GKE) some of these sort resizing by editing the cluster config and some don’t.