Rancher on Bare Metal Cloud: Setup Guide
Yes, Rancher can run on bare metal cloud servers, and it is a common setup for teams that want Kubernetes without a hyperscaler’s managed service. You install Rancher (the management plane) on one or more nodes, then use it to provision and manage Kubernetes clusters on the same or other bare metal machines. This guide explains what that involves, what to watch out for, and how to decide if it fits your workload.
What Rancher Does on Bare Metal
Rancher is a Kubernetes management platform. It provides a web UI and API to create, upgrade, and monitor clusters. On bare metal, you are responsible for the operating system, networking, storage, and the Kubernetes control plane yourself—Rancher only automates the deployment and day-2 operations. It does not provide the underlying compute, load balancers, or disk volumes; those come from your infrastructure or from add-ons you install.
Why Run Rancher on Bare Metal Instead of a Cloud Provider
Bare metal cloud (e.g., from providers like Equinix Metal, OVHcloud, or Hetzner) gives you dedicated physical servers. The main reasons teams choose this over a hyperscaler’s managed Kubernetes are:
- Cost predictability: You pay a flat monthly rate for the server, not per-second for CPU or storage I/O. For steady-state workloads, this can be cheaper than equivalent cloud VMs.
- Performance stability: No noisy neighbors. Your CPU, memory, and disk performance are consistent.
- Compliance and control: You know exactly which physical machine your data is on, which matters for some regulatory or contractual requirements.
- No vendor lock-in: You can move the same Rancher setup to another bare metal provider or your own colocation.
But you also lose the managed control plane, automatic scaling, and integrated load balancers that cloud providers offer. You must handle those yourself.
How to Install Rancher on Bare Metal
The standard method is to install Rancher as a container on a Linux host, then use Rancher’s UI or API to provision downstream clusters. Here is the general workflow:
- Prepare the host: Install a supported Linux distribution (Ubuntu 22.04, RHEL 9, etc.) on one server (or three for HA). Ensure Docker or containerd is installed, and that ports 80/443 (for the UI) and 6443 (for Kubernetes API) are open.
- Install Rancher: Run the Rancher container with a command like
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher:latest. For production, you should use a specific version tag, notlatest. - Set up the Rancher UI: Access the UI over HTTPS, set an admin password, and configure the server URL (the address nodes will use to reach Rancher).
- Provision a cluster: In the UI, choose “Create” and select a custom cluster. You will get a command to run on each bare metal node that joins it to the cluster. This command installs Kubernetes components (kubelet, kube-proxy, etc.) on that machine.
- Configure networking and storage: Install a CNI (like Calico or Cilium) and a storage provisioner (like Longhorn or Rook-Ceph) because bare metal has no built-in load balancer or cloud disk.
For high availability, you can install Rancher on three nodes with an external database (etcd) and a load balancer in front. The Rancher docs have a detailed HA installation guide.
Networking and Storage Considerations
Bare metal networking is different from a cloud VPC. You typically have one or more public IPs and possibly private VLANs. Key points:
- Load balancing: Cloud providers give you a managed load balancer. On bare metal, you need to run your own, such as MetalLB (Layer 2 or BGP) or a software load balancer like HAProxy on a separate node.
- Ingress: Rancher’s ingress controller (NGINX) needs a way to be reached. You’ll point a DNS record to the public IP(s) of your nodes and use MetalLB to assign an external IP to the ingress service.
- Storage: For persistent volumes, you need a storage class. Longhorn is a popular choice because it’s open-source and works on any Linux block device. It replicates data across nodes, so you don’t lose data if a disk fails.
- Firewall: You must open the necessary ports manually. Rancher needs 80/443, Kubernetes API needs 6443, and nodes need 2379/2380 for etcd if you run etcd on the same nodes. Misconfigured firewalls are the most common cause of cluster communication failures.
Common Problems and Misconceptions
A frequent misconception is that Rancher is a Kubernetes distribution that you install on a server and then you’re done. In reality, Rancher installs Kubernetes on your nodes, but you still need to manage the OS, networking, and storage. Another issue is assuming that the Rancher server can be a lightweight VM—it actually needs at least 2 vCPUs and 4 GB RAM, and if you manage many clusters, it can use more.
Common problems include:
- Node registration failures: Often due to wrong server URL or firewall rules. Ensure the nodes can reach the Rancher server on the specified port.
- etcd backup failures: If you don’t set up regular snapshots, you can lose the cluster state. Rancher has a built-in backup feature, but you must enable it.
- IP address changes: If a node’s IP changes, the kubelet certificate becomes invalid. Use static IPs or DHCP reservations.
- Upgrade issues: Upgrading Rancher itself can break if you skip versions. Always read the upgrade notes and back up your data first.
Costs and Performance Trade-offs
Bare metal pricing is typically a flat monthly fee per server. For example, a server with 32 GB RAM and 4 TB NVMe might cost around $100–$200 per month, depending on the provider. Compare that to a cloud VM with similar specs, which might cost $0.50/hour (about $360/month) plus storage and egress fees. For 24/7 workloads, bare metal often wins on price.
Performance-wise, you get the full machine. There’s no hypervisor overhead, so CPU and memory performance is close to native. Disk I/O is also faster because you’re using physical NVMe drives, not network-attached storage. However, you lose the ability to instantly resize or spin up new nodes. Provisioning a new bare metal server can take 5–15 minutes, whereas a cloud VM takes seconds.
Alternatives to Rancher on Bare Metal
If Rancher doesn’t fit, consider these alternatives:
- k3s: A lightweight Kubernetes distribution from the same company as Rancher. It’s easier to install on bare metal and works well for edge or smaller clusters. You can manage it with Rancher too, or standalone.
- Kubeadm: The manual way to set up Kubernetes. More control, but more work. No management UI.
- Talos Linux: An immutable OS designed for Kubernetes. It has its own API and can be managed via tools like Cluster API.
- Managed Kubernetes from a bare metal provider: Some providers (e.g., Equinix Metal with its Kubernetes service) offer managed control planes on bare metal, so you get the best of both.
Each has its own learning curve and trade-offs. Rancher is best if you want a unified UI for multiple clusters and don’t mind the extra operational overhead.
Frequently Asked Questions
Q: Can I run Rancher on a single bare metal server?
Yes, for testing or small production. You can run the Rancher server and a Kubernetes cluster on the same machine, but for production, separate the control plane and workers to avoid resource contention.
Q: Does Rancher work with any Linux distribution?
Rancher supports a list of tested OSes, including Ubuntu, CentOS/RHEL, and SUSE Linux Enterprise. It can work on others, but you may encounter issues. Always check the compatibility matrix in the docs.
Q: How do I back up Rancher and my clusters?
Rancher has a built-in backup operator that saves the Rancher database to a configured location. For Kubernetes clusters, use etcd snapshots. Schedule both regularly and store them off-node.
Q: What if my bare metal provider doesn’t support VLANs?
You can still use layer 2 networking with MetalLB in ARP mode, but it requires all nodes to be on the same L2 segment. If they aren’t, use BGP mode or a VPN overlay.
Q: Is Rancher free to use?
Rancher is open-source under the Apache 2.0 license. You can use it for free, but SUSE offers paid support and enterprise features. The open-source version includes all core functionality.
Q: Can I migrate an existing Kubernetes cluster to Rancher?
Yes, you can import an existing cluster into Rancher using the “Import” option. It will start managing it, but you need to ensure the cluster meets Rancher’s requirements (e.g., Kubernetes version compatibility).
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.