Playing with Rancher and Kubernetes Cluster

How manage and monitoring existing Kubernetes cluster with Rancher

Overview

Rancher was originally built to work with multiple orchestrators, and it included its own orchestrator called Cattle. With the rise of Kubernetes in the marketplace, Rancher 2.x exclusively deploys and manages Kubernetes clusters running anywhere, on any provider.

Rancher can provision Kubernetes from a hosted provider, provision computes nodes, and then install Kubernetes onto them, or import existing Kubernetes clusters running anywhere.

One Rancher server installation can manage thousands of Kubernetes clusters and thousands of nodes from the same user interface.

Rancher adds significant value on top of Kubernetes, first by centralizing authentication and role-based access control (RBAC) for all of the clusters, giving global admins the ability to control cluster access from one location.

It then enables detailed monitoring and alerting for clusters and their resources, ships logs to external providers, and integrates directly with Helm via the Application Catalog. If you have an external CI/CD system, you can plug it into Rancher, but if you don’t, Rancher even includes a pipeline engine to help you automatically deploy and upgrade workloads.

Rancher is a complete container management platform for Kubernetes, giving you the tools to successfully run Kubernetes anywhere.

Let’s Play

Actually, with Rancher, we can also create their own Kubernetes cluster. But here I will create a blog on how to manage the Kubernetes cluster that I created earlier. And here I will use the quick start manual for the Rancher server

What do you need for it?

● Existing Kubernetes cluster.
if you don’t have and don’t know how to create a Kubernetes cluster you can follow my blog.

https://riowiraldhani.medium.com/installation-kubernetes-high-availability-with-kubeadm-d1b3c075cf14

● One vm/server as the Rancher Server ( 4 VCPUs, and RAM 4GB)

How to set up Rancher Server

● Update and upgrade package

sudo apt update -y; sudo apt upgrade -y; sudo apt update -y

● Install and running docker.io

sudo apt install docker.io -y
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

● Running Rancher server

sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher

● Access Dashboard Rancher

https://IP_SERVER_RANCHER

● Set URL for dashboard Rancher

● Add Existing Cluster Kubernetes

● Here I use the existing Kubernetes cluster that I created using KVM, so I will use the user that is in my kube file. you can find it in the file /root/.kube/config

cat /root/.kube/config
...
kind: Config
preferences: {}
users:
- name: kubernetes-admin <<<<<<<<<<
...

● Create a new role for user kubernetes-admin and joining cluster to rancher server with file yaml.

kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user kubernetes-adminwget https://10.61.61.20/v3/import/md6k8mj9hlvnjxjhxx7lh8k9g756g6ffnnvt75rhfqq4thgc4rlh8j.yaml --no-check-certificatekubectl apply -f md6k8mj9hlvnjxjhxx7lh8k9g756g6ffnnvt75rhfqq4thgc4rlh8j.yaml

● Just wait until the cluster is ready for you to manage, and if the state has become Active, it means you can manage this cluster. And then click cluster name.

● Now, you can see about the imported Kubernetes cluster.

Until this point, you have successfully imported the Kubernetes cluster with Rancher server. Next, I will show you how to manage a cluster using a rancher server

● Explorer your cluster kubernetes

● The dashboard is almost similar to the dashboard from Kubernetes itself. And the function is the same, which is looking at your own cluster

● Let’s try, install or create service promotheus and grafana dashboard as a monitoring system for your Kubernetes cluster dashboard. First click Apps & Marketplace

● In this app and marketplace, we can see some of the services that ranchers have provided and that we can install. But here, we will try to install monitoring for your Kubernetes cluster. Click Monitoring.

● Choose your project, I’ll try to do it in the System project. And then click Install

● Just wait until the monitoring service is finished installing. and when it’s finished and the status has changed to deployed. Move to the monitoring menu

● Then click grafana, and you will be directed to the grafana dashboard.

● Here you will immediately be directed to the grafana home dashboard.

● Grafana also provides several dashboards that can be displayed. You can choose which dashboard or which resource you want to display

● This is another example of a dashboard. This dashboard displays compute resources and nodes (pods) in the Kubernetes cluster

How? interesting right? how easy it is to manage your existing kubernetes cluster. And how easy is it to deploy a service to monitor your Kubernetes cluster.

Maybe that’s enough to get the topic here, then maybe I’ll discuss other features provided by Rancher. If you want to request a topic for me to discuss, contact me.

I will be happy to discuss the topic you want.

thank you,

reference:
https://rancher.com/docs/rancher/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store