Get Cluster Type (RKE and k3s) over API

How can I check (ideally over an API) what type of Cluster the Cluster I want to inspect, consists of?

Example:

curl https://mycluster.cc/api/getClusterType
...
k3s

Inside of a particular cluster (i.e from the k8s API) that information doesn’t really exist in a convenient form. You can detect it from various sources like the version string or what images are running. We have a library for this which will be used in 2.5.

From the Rancher management API, if you created the cluster through Rancher then exactly one of the <ProviderName>Config keys on the cluster will be filled out (in /v3/clusters/<id>) with the configuration you provided, so that’s what kind of cluster it is. If it’s an imported cluster there’s just no provider info in 2.4.x (in 2.5 the detected provider from the library above will be a field on the cluster too).

I’ve read about the provider key, but it never even remotely mentioned something like RKE. It always was referring to cloud providers, so I assumed, that these are exclusive to the range of values the provider key can hold.

As is the case the case for k3s, a cluster is imported into Rancher. Will this imported cluster have a tag like that, as well, in 2.5?

The “cluster provider” is what was used to create the cluster itself. 2.5 will recognize (at the moment) Azure AKS, Amazon EKS, Google GKE, Minikube, K3s, RKE, and Docker desktop. Whether they were created by Rancher or by something else and then imported.

The “cloud provider” is a separate, but somewhat related thing, which controls various thing s like provisioning load balancers or detecting when underlying nodes have been deleted from the infrastructure. Mostly the only time you’d touch this is for RKE, where you might be running on e.g. EC2 nodes and want the EC2 provider.