How To Setup and Configure Rancher
Introduction
What is Rancher? Rancher is one of the market leaders in open-source cloud-native Kubernetes Management. It allows you to manage and scale workload consistently across thousands of clusters in any environment. Rancher supports any certified Kubernetes distribution. It monitors the health of all the clusters configured. And it makes the management of the K8s cluster as simple as one click. To know more you can visit their official site here.
Some Benifits of Rancher
Rancher just makes the all the task easy and manageable after you Kubernetes cluster is setup. Tasks that include scaling, checking, and monitoring the health of the cluster, setting up alerts and loggings, enabling security, and much more. It has its own app library which is actually based on Helm. It unlocks the true potential of Kubernetes by integrating with world-class open-source tools and software.
Here we will learn how to setup Rancher with your Kubernetes cluster. A Kubernetes cluster is a prerequisite.
Step 1. Install Rancher with Docker.
Run the command on your host server. I have already created a directory rancher-data to mount the container for persistent Volume. It is always good practice.
docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 -v /home/ubuntu/rancher-data:/var/lib/rancher rancher/rancher
It may take 2-3 mins to run completely.
Step 2. Now visit port 80 of the server on a browser. First, it will show the message “Connection is not Private”. Just ignore that and move forward by clicking on the Advanced button.

Then you will get the field to set the password for the default user (admin).
And give the server IP address in Rancher server URL.
Step3. Add cluster in Rancher
Now we can add our cluster in Rancher. Just click on the “Add Cluster” button and it will open this page
These are all the different Kubernetes cluster providers. In our case, we will use the “Import an existing cluster” to configure our cluster on the host server on which this Rancher is running.
Step 4. Configure the K8s cluster in Rancher by downloading the YAML config file.
Run the last command at the bottom. This will work in most cases
Note: Command will vary of every setup so just copy the command from this page.
This command will download the configuration file (YAML).
Step 5. Apply the downloaded file in your cluster.
$ kubectl apply -f <config-file.yaml>
And your Kubernetes cluster is configured in Rancher.
The Dashboard will show the information of your cluster and the node panel will show you the information of your nodes.
Step 6. Deploy a Pod or Deployment
Follow these steps to deploy a Pod or Deployment:
Hover over the cluster’s name > Select a namespace > Click on the deploy button.
Step 7. Fill the details
Step 8. Manage all your pods in one place.
There it is, a brief setup of Rancher for a Kubernetes cluster.
Tip: To access the shell terminal of any deployment in Rancher, follow these steps:
Click on the desired deployment > Click on 3 dots at right. > Click on Execute Shell.
Conclusion:
This is a simple and brief setup tutorial for Rancher for a K8s cluster. We can add more clusters and manage all at the same time. This simple setup is enough to the potential of this tool. One can do much more with this.