In today's world of cloud landscape, Kubernetes is everywhere. Without a doubt, Kubernetes has become the standard for orchestrating containers. But managing multiple clusters running everywhere on different platforms in a consistent and secure way produce new sets of challenges. So at this point Rancher comes in picture. As, an artificial intelligence development company, we at Oodles are overcoming cluster-related challenges by setting-up Kubernetes Cluster in Rancher.
Rancher, an open-source container management platform. It makes it easy for any organization to adopt Kubernetes wherever it runs. In Rancher, you can manage cloud-hosted Kubernetes clusters running on GKE, EKS, AKS or just simply deploy a Kubernetes cluster on your choice of virtual machines (VM) or bare metal infrastructure. And, you can even import your Kubernetes cluster in Rancher fully supported environment irrespective of platform.
After your Kubernetes cluster is provisioned and running. Rancher simplifies all the operations and responsibilities for administrations. This includes monitoring the health of the cluster, setting alerts and notifications, enabling logging, defining and applying security policies, enabling authentications, and much more. It has its own app library which is based on Helm. These all features make Rancher a perfect tool to manage Kubernetes clusters.
So let's see the steps of how you can set up and use this amazing tool.
In this case, I already have a Kubernetes cluster running. Steps will guide you on how to set up Rancher and add your existing cluster in Rancher and deploy a simple deployment in a cluster.
Step1. Goto to Rancher's website and you can find deployment steps.
Deploy Rancher: https://rancher.com/quick-start/
Step2. To install rancher run this command on your host. For persistent volume, I have created a directory named rancher-data and mounted with the container through the below command.
$ sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 -v /home/ubuntu/rancher-data:/var/lib/rancher rancher/rancher
it will take around 2 minutes.
Step3. Open a browser and go to the 80 port of the server. It will show the Connection is not a private message. So just go forward in the ‘Advanced' button on the page. Then set a password for default user (admin) and provide IP address in Rancher server URL step.
Step4. Now add a cluster by clicking “Add Clusterâ€. This will lead to a page like this
Rancher support all these platforms and we are going to use the “Import an existing cluster†option.
Step5. Now select the import option and create a cluster with the appropriate name.
Step6. Now run the bottom last command as the middle one doesn't work most time. The reason is specified on this page.
It will download a YAML file and apply it to your Kubernetes cluster. This will create a new namespace called “cattle-system†and all the Rancher related resources are going to deploy in that namespace.
Step7. Now you can go to your new cluster and see the dashboard which shows some basic info related to the cluster. Similarly, you can see the metrics of each node in the Nodes panel at the top.
Step8. Now let's deploy a deployment or a pod in cluster. Hover over the name of your cluster at the top and select a namespace (default) > click on Deploy.
Step9. Provide the required details for the deployment and click launch.
You can see your all pods in the Workloads section in the cluster.
This will conclude the end of this brief Rancher setup.
Additional Tip: You can access the shell of deployment directly from Rancher. Just follow the below steps:
Click on the deployment (in this case postgres-demo) >> click on 3 dot >> select Execute shell.
Conclusion:
This is a simple guide for setting up the Rancher tool. This shows how powerful and at the same time how amazing a tool can be which does the complex tasks. Managing a single Kubernetes cluster is a complex task. But this tool can make your work tremendously easy and simple. If you work with Kubernetes then giving Rancher a try is worthwhile.
We, at Oodles, as a machine learning development company, are a team of next-gen developers deploying advanced tools and technologies like Kubernetes, Redux, Rancher et al. We harness the power of AI and machine learning coupled with advanced tools to build automation solutions, including-
Connect with our AI developers to learn more about our AI capabilities