Rancher provides a unified front end for multiple container orchestration frameworks and environments, giving you a “single pane of glass” for deploying containers wherever you need. The steps to follow for the creation of a GKE cluster on Rancher are as follows:
Login to google account and go to console.
Next, select the project you want to work on.
Click on the navigation tab on the top left of your screen. Select VM instances under Compute Engine. This redirects you to a screen displaying a list of all the available VM instances in the project.
Only one instance is to be created on which Rancher UI will be installed. Click on CREATE INSTANCE option.
Next, We need to provide the necessary details such as Instance Name, Region, Zone, Machine Configuration(Series : N2).
Choose Ubuntu 18.04 LTS as an OS image, Boot Disk Type as Standard Persistent Disk and size as 10 GB.
Select "Allow HTTP/HTTPs Traffic" under firewall rules and click on Create.
Now, wait for the VM instance to get created. Once the instance is created, Click on the SSH option to install Rancher UI on newly created instance.
Run the following commands in SSH window of the newly created instance to install Rancher UI packages.
sudo apt-get update -y
sudo apt-get install -qy docker.io
sudo apt-get update -y
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest
Now, go to the VM instances list dashboard. Click on the External IP of the respective VM instance on which Rancher UI packages are installed in step 6.
Clicking on the External IP will redirect us to Rancher Dashboard for creating the password and saving URL. Click on Continue.
Click on Save URL.
After saving the URL, you will be redirected to cluster dashboard. Click on Add Cluster option, present at the top right corner in the cluster dashboard.
We need to specify the hosted Kubernetes provider. Click on Google GKE present at the bottom.
Now, enter the cluster name and give the service account private key JSON file. Click on Next: Configure Nodes.
Fill in the Kubernetes Options details such as location type, zone, kubernetes version etc.
Fill in the Node Options details such as Node Count, Machine Type, Image Type, Root Disk Type, Root Disk Size etc.
Click on Create.
You will see that the cluster is getting provisioned and is active after a few minutes.
Now, Click on the newly created cluster name. Go for "Launch Kubectl" option and execute the command provided below to verify the cluster creation and number on nodes present in it.
$ kubectl get nodes
$ kubectl get pods -n kube-system