How to Self-Host Rancher for Kubernetes Management

What Is Rancher?

Rancher is SUSE’s open-source Kubernetes management platform. It provides a web UI for provisioning, managing, and monitoring multiple Kubernetes clusters from a single pane of glass. It can deploy k3s, RKE2, or import existing clusters. Rancher handles RBAC, monitoring (Prometheus/Grafana), logging, GitOps (Fleet), and app deployment via Helm charts.

Prerequisites

  • A Linux server (Ubuntu 22.04+ recommended)
  • Docker installed (guide)
  • 4 GB of RAM minimum (8 GB recommended)
  • 2 CPU cores minimum
  • A domain name (recommended for TLS)
  • Port 80 and 443 open

Docker Compose Configuration

For evaluation and small deployments, Rancher runs as a single Docker container:

services:
  rancher:
    image: rancher/rancher:v2.13.3
    container_name: rancher
    restart: unless-stopped
    privileged: true
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - rancher-data:/var/lib/rancher
    environment:
      # Optional: Set initial admin password (avoids bootstrap UI)
      CATTLE_BOOTSTRAP_PASSWORD: ${ADMIN_PASSWORD:-admin}

volumes:
  rancher-data:

Create a .env file:

# Initial admin password
ADMIN_PASSWORD=your-secure-password-here

Start Rancher:

docker compose up -d

Note: The Docker deployment runs a full k3s cluster inside the container (hence privileged: true). For production, deploy Rancher on a dedicated Kubernetes cluster via Helm.

Initial Setup

  1. Wait 1-2 minutes for Rancher to start (it bootstraps an internal k3s cluster)
  2. Access Rancher at https://your-server (self-signed certificate — accept the warning)
  3. Set the admin password if you didn’t set CATTLE_BOOTSTRAP_PASSWORD
  4. Set the Rancher Server URL — the URL that nodes will use to reach Rancher
  5. You’ll see the dashboard with the local cluster (Rancher’s internal cluster)

Import an Existing Cluster

  1. Click “Import Existing” from the cluster management page
  2. Select “Generic”
  3. Copy the kubectl command and run it on your existing cluster:
kubectl apply -f https://rancher.example.com/v3/import/xxx.yaml

Provision a New k3s Cluster

  1. Click “Create”“Custom”
  2. Name the cluster and configure settings (Kubernetes version, network provider)
  3. Copy the registration command
  4. Run it on each node you want in the cluster

Configuration

User Management

  1. Go to Users & AuthenticationUsers
  2. Create users and assign roles:
    • Administrator — full access to all clusters
    • Standard User — can create/manage assigned clusters
    • User-Base — read-only access

Monitoring Setup

Rancher includes a monitoring stack (Prometheus + Grafana):

  1. Go to your cluster → AppsCharts
  2. Install Monitoring from the Rancher charts
  3. Grafana dashboards are available at the monitoring URL
  4. Prometheus scrapes all cluster metrics automatically

App Deployment

Deploy Helm charts from the Rancher UI:

  1. Go to your cluster → AppsCharts
  2. Browse the chart repository (Rancher, Bitnami, community)
  3. Click Install, configure values, and deploy

Fleet (GitOps)

Rancher includes Fleet for GitOps deployments:

  1. Go to Continuous Delivery
  2. Add a Git repository URL
  3. Configure target clusters and paths
  4. Fleet automatically deploys changes when you push to the repo

Advanced Configuration (Optional)

Production Deployment (Helm on k3s)

For production, deploy Rancher on a dedicated k3s cluster:

# 1. Install k3s
curl -sfL https://get.k3s.io | sh -

# 2. Install cert-manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.2/cert-manager.yaml

# 3. Wait for cert-manager
kubectl wait --for=condition=Ready pods -l app=cert-manager -n cert-manager --timeout=120s

# 4. Install Rancher via Helm
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm install rancher rancher-latest/rancher \
  --namespace cattle-system --create-namespace \
  --set hostname=rancher.example.com \
  --set bootstrapPassword=admin \
  --version 2.13.2

TLS Configuration

For the Docker deployment, use a reverse proxy with proper certificates. For Helm, Rancher can use cert-manager (Let’s Encrypt), bring-your-own certificates, or an external TLS termination.

Reverse Proxy

If running the Docker deployment behind a reverse proxy, configure Nginx Proxy Manager or Caddy to proxy HTTPS to Rancher on port 443. WebSocket support is required for the real-time UI.

For detailed proxy setup, see Reverse Proxy Setup.

Backup

For the Docker deployment:

# Stop Rancher, back up the data volume
docker compose stop
docker run --rm -v rancher-data:/data -v $(pwd):/backup alpine \
  tar czf /backup/rancher-backup.tar.gz -C /data .
docker compose start

For Helm deployments, use the Rancher Backup operator:

helm install rancher-backup-crd rancher-charts/rancher-backup-crd -n cattle-resources-system --create-namespace
helm install rancher-backup rancher-charts/rancher-backup -n cattle-resources-system

For a full strategy, see Backup Strategy.

Troubleshooting

Rancher UI Not Loading

Symptom: https://your-server doesn’t load or shows connection refused.

Fix: Rancher takes 1-2 minutes to start. Check container logs:

docker logs rancher -f

Wait for the message indicating the UI is ready. If it fails, check if ports 80/443 are already in use.

Cluster Import Fails

Symptom: “Waiting for agent” status after importing a cluster.

Fix: The cluster must be able to reach the Rancher server URL. Verify:

# From the target cluster
curl -k https://rancher.example.com/ping

If using a private IP, ensure the target cluster nodes can route to it.

High Resource Usage

Symptom: Rancher container uses excessive CPU or memory.

Fix: The Docker deployment runs an embedded k3s cluster. Memory usage of 1.5-2 GB is normal. If it exceeds 4 GB, check for stuck webhooks or excessive cluster monitoring.

Resource Requirements

  • RAM: 1.5 GB idle (Docker deployment), 4 GB minimum for usable performance
  • CPU: 2 cores minimum
  • Disk: 2 GB for Rancher + data, grows with cluster count and monitoring data

Verdict

Rancher is the best Kubernetes management UI available. If you’re running multiple clusters, need provisioning automation, or want integrated monitoring and GitOps, Rancher delivers all of this in one platform.

Use Rancher if: You manage multiple Kubernetes clusters and want a unified management UI. You need cluster provisioning, RBAC management, monitoring, and GitOps.

Consider Portainer instead if: You primarily manage Docker containers and want a simpler tool. See Rancher vs Portainer.

Consider just k3s if: You only have one cluster and don’t need a management UI — kubectl and Helm are enough. See How to Self-Host k3s.

FAQ

Do I need Rancher to use k3s?

No. k3s works perfectly standalone with kubectl and Helm. Rancher adds a management UI on top, but it’s optional.

Is the Docker deployment production-ready?

Docker single-node is fine for managing a few clusters. For HA and production, deploy Rancher on a dedicated 3-node k3s cluster via Helm.

Does Rancher cost money?

Rancher is open source (Apache 2.0). SUSE Rancher Prime adds enterprise support and additional features, but the core platform is free.

Comments