Prerequisites
- Rancher 2.8 or later, reachable from the internet over HTTPS. Commands run in the CloudThinker cloud. For an internal Rancher, see Reaching private services. These docs don’t publish CloudThinker’s egress IP list: ask your CloudThinker contact, or contact us.
- Permission in Rancher to create a user and assign cluster and project roles.
- Optional: the PEM certificate of your private certificate authority, if Rancher’s certificate is not publicly trusted.
Setup
Create a dedicated Rancher user
- Open ☰ → Users & Authentication → Users and click Create. Enter a Username such as
cloudthinkerand a New Password. Under Global Permissions, select User-Base instead of the default Standard User, which can create clusters. User-Base lets the account sign in and nothing more. Click Create. - In each cluster you want inspected, open ☰, select the cluster under Explore Cluster, then open Cluster → Cluster and Project Members in the left menu.
- On the Cluster Membership tab, add the user with Cluster Member (or your custom role).
- On the Project Membership tab, add the user to each project with Read Only.
Create an API key
- Expiry: pick a date that matches your rotation schedule, such as 90 days. Rancher caps it at the server’s
auth-token-max-ttl-minutessetting, which you can check in ☰ → Global Settings → Settings, and uses the cap without warning if you ask for longer. When the key expires, the connection switches to Error. Create a new key and enter it with Replace credentials on the detail panel, which appears once the connection shows Error. See Rotate a credential. - Scope: leave it as No Scope. A scoped key only works against one cluster’s Kubernetes API, which this connection does not use.
Add the connection in CloudThinker
Connection details
Required permissions
The API key’s user needs read access to clusters, nodes, projects, and cluster and project role bindings. Pick one recipe:- Built-in roles: Cluster Member on each cluster, plus Read Only on each project (Setup step 1, items 3 and 4).
- Custom role: the custom cluster role below on each cluster, in place of Cluster Member. Its rule includes projects and project role bindings. Run the check below, and add Read Only on a project only if that check reports a permission error for it.
Who holds Rancher access to the <project> project on <cluster>?. The answer must list bindings. If it reports a permission error, the role doesn’t reach that project.
What this connection cannot reach
The connection only sends read requests to Rancher’s management resources. These stay out of reach even if the API key’s user could read them:- Secrets, kubeconfigs, API tokens, and cluster registration tokens
- Cloud credentials, authentication settings, and global settings
- Any change to Rancher: creating, updating, deleting, or scaling
- The older Rancher
v3API
Agent capabilities
Show node readiness for the prod-sea cluster. Whenever a message mentions Rancher, agents query it live instead of reusing a result from an earlier message.
Verify the connection
Example prompts
Troubleshooting
Rancher rejected the API token
Rancher rejected the API token
Rancher accepted the token but it lacks read access to managed clusters
Rancher accepted the token but it lacks read access to managed clusters
The Rancher server did not expose the management.cattle.io RK-API
The Rancher server did not expose the management.cattle.io RK-API
/apis/management.cattle.io/v3. The URL points somewhere other than the Rancher server root, or the Rancher release is older than 2.8. Reconnect with the plain Rancher address and check your version.Could not reach the Rancher server
Could not reach the Rancher server
Rancher URL must use HTTPS outside local development
Rancher URL must use HTTPS outside local development
http://, which would send the API key in clear text. On CloudThinker’s cloud, http:// is refused for every host, including localhost. Serve Rancher over HTTPS and reconnect with an https:// URL.Invalid Rancher CA certificate bundle or connection configuration
Invalid Rancher CA certificate bundle or connection configuration
Connection 'rancher' already exists. Only one instance is allowed.
Connection 'rancher' already exists. Only one instance is allowed.
An agent reports fewer clusters than Rancher shows
An agent reports fewer clusters than Rancher shows
Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- Narrow through roles. The API key sees exactly what its user sees, so the user’s roles are your only scope control.
- Read-only by construction. The connection can only send read requests, so no permission you grant lets an agent change Rancher.
- Plan for expiry. A workspace holds one Rancher connection, so there’s no in-place swap while it’s healthy. Either wait for Error and use Replace credentials, or rotate early by disconnecting and connecting again with a new key. Reconnecting reruns Discovery and means checking that Rules still name the connection. See Rotate a credential.
- Revoke at the source. Delete the API key in Account & API Keys, or deactivate the user, to stop all access through this connection.