Introduction
Rancher is a complete container management platform built for organizations that deploy containers in production. It provides a centralized authentication and access control system for managing multiple Kubernetes clusters from a single interface.High-Level Architecture
Rancher follows a hub-and-spoke architecture pattern with these core concepts:Management Cluster
The central Rancher server that runs in a Kubernetes cluster and manages all downstream clusters.
Downstream Clusters
Kubernetes clusters managed by Rancher, which can be imported, created, or hosted.
Core Architecture Components
Rancher Server
The Rancher server is the central management hub that consists of:- API Server: Multi-versioned API system (Norman v3 and Steve v1)
- Authentication System: Pluggable authentication with support for multiple providers
- Controller Manager: Reconciliation loops for managing cluster state
- UI Server: Web-based management interface
- Extension API Server: Kubernetes API aggregation for imperative operations
The main server process is defined in
main.go:49 and initializes with the command: Complete container management platformCluster Management Model
Upstream vs Downstream
Upstream Cluster (Management/Local)
Upstream Cluster (Management/Local)
- Runs the Rancher server components
- Stores cluster configurations and state
- Manages authentication and RBAC policies
- Can optionally manage workloads when configured as “local” cluster
- Namespace:
cattle-system
Downstream Clusters
Downstream Clusters
- Kubernetes clusters managed by Rancher
- Run the Rancher agent for communication
- Can be imported, provisioned, or hosted
- Independent Kubernetes API servers
Communication Patterns
Tunnel Server Architecture
Rancher uses a WebSocket-based tunnel system for secure cluster communication:The tunnel server is implemented in
pkg/tunnelserver/ and uses the remotedialer library for bidirectional communication.Agent-Server Communication
Key aspects of the communication model:- Outbound Connections Only: Agents initiate connections to the Rancher server via WebSocket
- No Inbound Firewall Rules: Downstream clusters don’t need to expose ports
- TLS Encryption: All communication is encrypted using TLS
- Token Authentication: Service account tokens for authentication
- Peer Management: Multi-replica support with peer coordination
Multi-Cluster Manager (MCM)
The Multi-Cluster Manager is responsible for:- Cluster Registration: Managing cluster lifecycle and registration tokens
- Proxy Routing: Proxying requests to downstream cluster APIs
- Resource Aggregation: Collecting metrics and status from all clusters
- RBAC Enforcement: Applying management-level access controls
High Availability Architecture
Server Replica Management
Rancher supports multiple replicas for high availability:values.yaml:189
Leader Election
- Controllers use Kubernetes leader election
- Only one replica runs reconciliation loops
- Other replicas serve API requests
- Peer coordination via endpoints monitoring
Load Distribution
Data Storage Architecture
Kubernetes API as Database
Rancher uses Kubernetes CRDs for persistent storage:- Cluster Definitions:
management.cattle.io/v3API group - User Configurations: RBAC rules, tokens, auth configs
- Settings: Global and per-cluster settings
- Catalog Data: Helm chart repositories and applications
SQL Cache (Optional)
For improved UI performance:Environment Variables
Request Flow
Management API Request
Downstream Cluster API Request
Deployment Modes
- Docker Installation
- Helm Installation
Single-node development deployment:
- Embedded Kubernetes mode
- Automatic service/endpoint creation
- Suitable for testing only
Networking Requirements
Rancher Server
| Port | Protocol | Purpose |
|---|---|---|
| 80 | HTTP | Redirect to HTTPS |
| 443 | HTTPS | API and UI access |
| 444 | HTTPS | Internal aggregation API (optional) |
Downstream Clusters
- Outbound HTTPS (443): For agent-server communication
- Optional: Direct kubectl access to cluster API
Key Subsystems
Authentication
Multi-provider authentication system with SAML, OIDC, LDAP, and local auth
Controllers
Reconciliation loops managing cluster lifecycle, node drivers, and fleet
API Layers
Norman (v3) and Steve (v1) API systems with different paradigms
Provisioning
Cluster provisioning via RKE2, K3s, and hosted Kubernetes providers
Related Topics
Components
Deep dive into server components
Security
Security architecture and RBAC
API Reference
API documentation