Skip to content

How to List Rancher Management Objects (Clusters, Nodes, Users, Tokens) with kubectl

Article Number: 000022324

Environment

Rancher v2.5+

Procedure

This article provides commonly used kubectl commands to list and inspect Rancher management API objects, including clusters, nodes, users, and tokens. These resources are stored as custom resources in the Rancher management cluster and can be queried directly using kubectl. The commands shown here present the information in a clear, human-readable format, which is useful for troubleshooting, auditing, and verifying Rancher configuration.

Clusters information: 
Command:

kubectl get clusters.management.cattle.io -o custom-columns="ID:.metadata.name,NAME:.spec.displayName,DRIVER:.status.driver,K8S_VERSION:.status.version.gitVersion,CREATED:.metadata.creationTimestamp,DELETED:.metadata.deletionTimestamp,LAST_READY:.status.conditions[?(@.type == 'Ready')].lastUpdateTime,READY:.status.conditions[?(@.type == 'Ready')].status" --sort-by=.metadata.creationTimestamp

Example Output:

ID             NAME         DRIVER     K8S_VERSION      CREATED                DELETED   LAST_READY             READY
local          local        rke2       v1.34.2+rke2r1   2026-01-21T03:39:59Z   <none>    <none>                 True
c-m-g2zxtbrm   test-rke2    imported   v1.34.3+rke2r1   2026-02-03T02:14:16Z   <none>    2026-02-03T02:24:05Z   True

Nodes Information
Command:

kubectl get nodes.management.cattle.io -A -o custom-columns="NAMESPACE:.metadata.namespace,ID:.metadata.name,NAME:.status.nodeName,K8S:status.internalNodeStatus.nodeInfo.kubeletVersion,CP:spec.controlPlane,ETCD:spec.etcd,WORKER:spec.worker,OS:status.internalNodeStatus.nodeInfo.osImage,KERNEL:.status.internalNodeStatus.nodeInfo.kubeletVersion"

Example Output:

NAMESPACE      ID              NAME                           K8S              CP      ETCD    WORKER   OS                   KERNEL
c-m-g2zxtbrm   machine-9pgfw   test-rke2-worker-482hb-j86wk   v1.34.3+rke2r1   false   false   true     Ubuntu 22.04.4 LTS   v1.34.3+rke2r1
c-m-g2zxtbrm   machine-l22sl   test-rke2-master-rzb57-wj2k6   v1.34.3+rke2r1   true    true    false    Ubuntu 22.04.4 LTS   v1.34.3+rke2r1
c-m-g2zxtbrm   machine-mnt7d   test-rke2-worker-482hb-7zgrn   v1.34.3+rke2r1   false   false   true     Ubuntu 22.04.4 LTS   v1.34.3+rke2r1
c-m-g2zxtbrm   machine-z4c4g   test-rke2-worker-482hb-pfq9c   v1.34.3+rke2r1   false   false   true     Ubuntu 22.04.4 LTS   v1.34.3+rke2r1
local          machine-fcmmf   ip-172-31-21-69                v1.34.2+rke2r1   true    true    false    Ubuntu 24.04.3 LTS   v1.34.2+rke2r1

Users Information
Command:

kubectl get users.management.cattle.io -A -o custom-columns=ID:'{.metadata.name},Name:'{.username},DisplayName:'{.displayName}'

Example Output:

ID             Name     DisplayName
u-b4qkhsnliz   <none>   System account for Cluster local
u-lchgeakhwh   <none>   <none>
u-mo773yttt4   <none>   <none>
u-yd2xevlc4q   <none>   System account for Cluster c-m-g2zxtbrm
user-kxdgm     admin    Default Admin

Tokens Information
Command:

kubectl get tokens.management.cattle.io -o custom-columns=Name:'{.metadata.name}',ID:'{.userId}',DisplayName:'{.userPrincipal.displayName}',User:'{.userPrincipal.loginName}',Created:'{.metadata.creationTimestamp}'

Example Output:

Name           ID             DisplayName     User     Created
token-kwcwg    user-kxdgm     Default Admin   admin    2026-02-03T02:12:21Z
u-lchgeakhwh   u-lchgeakhwh   <none>          <none>   2026-02-03T02:18:43Z
u-mo773yttt4   u-mo773yttt4   <none>          <none>   2026-01-21T03:41:36Z

For more details on API token, please refer to this KB Article: How to query Rancher API tokens information via kubectl