A guide to get you started with Kubernetes on bare metal with Rancher RKE2
Initial setup
Install k3s on the Rancher server
Setup kubectl on your local machine
/etc/rancher/k3s/k3s.yaml
.rke2-kubeconfig.yaml
) and paste the contents of the k3s.yaml
file into it.Update the server URL in the kubeconfig file to point to the Rancher server’s IP address. Leave the IP URL with HTTPs and port 6443.KUBECONFIG
environment variable to point to the location of your kubeconfig file:kubectl get nodes
. It should display the node of your Rancher cluster, similar to the following:Install Rancher with Helm
https://<IP_OF_SERVER>.sslip.io
and log in with the password you have set for the Rancher admin user. You should see the following screen:Create 3 servers
Create the cluster
etcd
, Control Plane
, and Worker
checked. Click on Show Advanced, select one of the servers you created for the cluster, and add its hostname and public IP.Bonus: If you want cluster communication through a private network, set up a private network and add the private IP under Node Private IP.In Step 3, as we are using a self-signed certificate, check the Insecure option. If you set up your domain with TLS, leave insecure unchecked.Copy the registration command and run it on the first server, the same server you used to install Rancher. You should see it being registered.Repeat the same process for the other two servers. You can run different roles on different servers. For example, you can run etcd
and Control Plane
on one server and Worker
on the other two.That's it