Skip to content

Fix Rancher Cluster Import – Imported Cluster Not Showing

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Fix Rancher Cluster Import. We cover key concepts, practical examples, and best practices.

You generate the import.yaml from Rancher, apply it to your Kubernetes cluster, and wait. The cluster appears in Rancher's Cluster Management but stays in Pending or Importing state for minutes — even hours.

Wrong ❌

# You run the command from Rancher's UI
kubectl apply -f https://rancher.example.com/v3/import/abc123.yaml

```text
Cluster: my-cluster
State: Pending

You check the Rancher logs:

Failed to check if cluster is ready: cluster "my-cluster" is not ready yet

The cluster never transitions to `Active`. Rancher can't communicate with the imported cluster.

## Right ✅

**Verify the agent pods are running:**

```bash
kubectl get pods -n cattle-system

Expected output:

NAME                              READY   STATUS    RESTARTS
cattle-cluster-agent-xxx          1/1     Running   0
cattle-node-agent-xxx             1/1     Running   0

If pods are `CrashLoopBackOff` or `Pending`, check logs:

```bash
kubectl logs -n cattle-system deployment/cattle-cluster-agent

Common errors:

- **"x509: certificate signed by unknown authority"** — the Rancher server certificate isn't trusted on the downstream cluster.
- **"connection refused"** — the downstream cluster can't reach the Rancher server URL.

**Fix — ensure Rancher URL is accessible:**

The import command includes the Rancher server URL. The downstream cluster must be able to reach it:

```bash
# From the downstream cluster
curl -k https://rancher.example.com/ping
# → pong

If it can't reach Rancher directly, use a **proxy**:

```yaml
# In the cluster's cattle-cluster-agent deployment, set:
env:
  - name: HTTP_PROXY
    value: http://proxy.example.com:8080

**Regenerate the import command with the correct URL:**

1. Rancher → **Cluster Management** → **Import Existing Cluster**
2. Ensure the **Cluster Name** matches
3. Under **Cluster Agent** options, verify the Rancher Server URL is correct
4. Run the new command

✅ Cluster 'my-cluster' is now Active.

## Root Cause

The `cattle-cluster-agent` pod requires network connectivity from the downstream cluster to the Rancher server. If DNS, firewall, or TLS trust is broken, the agent can't register and the cluster stays in `Pending`.

## Prevention

- Use a private DNS name or IP that both Rancher and downstream clusters can resolve.
- Trust the Rancher CA on each downstream cluster node, or use a publicly‑signed certificate.
- Pre‑test connectivity with `curl` before importing.
- For air‑gapped environments, use the **Rancher Import** command with internal URLs.


## Common Mistakes with cluster import

1. **Using `foldl` instead of `foldl'` causing stack overflow on large lists**
2. **Forgetting `deriving (Show, Eq)` on custom data types needed for debugging**
3. **Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable**

These mistakes appear frequently in real-world RANCHER code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

## Practice Exercise

**Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.**

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

## FAQ

<details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Can I import an offline cluster?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes — use the <strong>Restricted network</strong> (air‑gap) import method. You'll need a private image registry.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Why is my cluster stuck in "Reconnecting"?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: The agent lost connectivity to Rancher. Check the <code>cattle-cluster-agent</code> pod logs and network path.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: How long does import normally take?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: 30–60 seconds. If it takes longer, check agent pods, network, and TLS.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: What if I can't use `kubectl apply` on the cluster?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: You can't import a cluster without <code>kubectl</code> access. Use Rancher's alternative method via <strong>Cluster Management</strong> if you have kubeconfig but no direct access.</p>
</div></details>

---

*Cluster import is covered in the [DodaTech Rancher Cluster Management course](https://dodatech.com/courses/rancher).*

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro