Overview
When you import a cluster, Rancher:- Deploys the cluster agent to establish communication
- Creates a management relationship without modifying the cluster’s core infrastructure
- Enables centralized access control, monitoring, and workload management
imported (defined as ClusterDriverImported in /home/daytona/workspace/source/pkg/apis/management.cattle.io/v3/cluster_types.go:76).
Prerequisites
- An existing Kubernetes cluster
kubectlaccess to the cluster with cluster-admin privileges- Network connectivity from the cluster to the Rancher server
- The cluster’s kubeconfig file
Import Process
- Kubernetes Version: Detected automatically after import
- Private Registry: Set
ImportedConfig.PrivateRegistryURLif using a private registry - Agent Environment Variables: Configure custom environment variables if needed
After creating the cluster, Rancher generates a registration token and provides kubectl commands to apply the agent manifest.
ClusterRegistrationToken resource/v3/import/{token}.yamlSee Registration Tokens for details on token management.
The insecure command skips TLS verification. Only use this in development environments or when your Rancher server uses self-signed certificates.
cattle-cluster-agent in the cattle-system namespaceAgentDeployed condition is set to true in the cluster statusCluster Configuration
Imported clusters use theImportedConfig specification:
/home/daytona/workspace/source/pkg/apis/management.cattle.io/v3/cluster_types.go:183
Private Registry Support
If your cluster requires a private registry for pulling Rancher agent images:- Specify the
privateRegistryURLduring import - Rancher configures the agent to use this registry
- Ensure the registry contains the required agent images
Agent Components
The import process deploys:- cattle-cluster-agent: Primary agent for cluster communication
- cattle-node-agent: Node-level agent for node management (if applicable)
- Establish secure websocket connections to Rancher
- Synchronize cluster state and resources
- Execute operations requested through the Rancher UI
- Report cluster metrics and health status
Network Requirements
- Outbound: The cluster must reach the Rancher server URL
- Ports: HTTPS (443) or custom port if configured
- Proxy: Configure HTTP_PROXY/HTTPS_PROXY in agent environment variables if needed
Cluster Capabilities
After import, Rancher detects and reports cluster capabilities:- Load balancer support
- Ingress controllers
- Node port range
- Storage classes
- Taint support
Post-Import Operations
Once imported, you can:- Generate kubeconfig files for kubectl access
- Rotate certificates (for supported cluster types)
- Configure backup schedules (for RKE clusters)
- Deploy workloads through Rancher
- Configure monitoring and alerting
- Manage cluster members and RBAC
Limitations
- Imported clusters cannot be upgraded through Rancher
- Cluster infrastructure modifications must be performed outside Rancher
- Some operations (like etcd backup) are only available for RKE clusters
- Certificate rotation is limited to RKE2/K3s clusters
Troubleshooting
Agent Fails to Connect
- Verify network connectivity from the cluster to Rancher
- Check the agent logs:
- Verify the registration token hasn’t expired
- Ensure the Rancher server URL is accessible from the cluster
Cluster Stuck in “Pending” State
- The agent deployment may not have been applied
- The agent may be failing to start (check pod status)
- Network policies may be blocking agent communication
Certificate Errors
- Use the insecure command if Rancher uses self-signed certificates
- Configure custom CA certificates in the cluster if needed