Skip to content

Step 2: Setting up Kubernetes cluster using Rancher

Himanshu Joshi edited this page May 6, 2022 · 7 revisions

Goal: Setup a master-worker K8s cluster using Rancher.

Prerequisites: You need 3 VM's. (To be on safer side, anything above 8GB RAM should be sufficient).

Now that we installed Rancher in Step-1. We will setup the Kubernetes cluster from the Rancher UI.

1. Setting up etcd, worker and master. (First VM).

  1. Login to your Rancher dashboard. Click on Add Cluster at the top of the page.
  2. Select existing nodes.
  3. Give any Cluster Name of your choice and use Networking as Calico. Rest keep everything as default.
  4. Click Next.
  5. For the Node Role, select etcd, control plane and worker and click on advanced options. (Very Important)
  6. Enter the public IP address on any one VM and give a node name. You can ignore the field Node Internal address.
image
  1. Now, copy the command and run this command on the VM whose IP address you mentioned.
  2. After a minute you should get a message. Node registered.
    Wait for 5-10 mins. You should see the cluster to be in Active state.
    image
    Refer Known Issues below, if not in Active stage.

So, we have one master and one worker pointing to the same node.

2. Setting up the remaining workers.

  1. Now, on the home screen click on three dots of the cluster you setup. Click on Edit.
image
  1. Go to the bottom. And now select worker as Node role and update the IP address of a different VM. This VM will act as a worker node.
image
  1. Copy the command again and run this on the VM (whose IP address we mentioned above).

Repeat the above steps for the third VM. Your final dashboard should look something like this.

image

Now, before proceeding to the next steps. You need to create 3 partitions to all the VM's for setting up the Databases. Here is a nice write up from Team CloudElves. Please follow that to attach volumes before proceeding to the next step.

Known Issues:

  1. If the first node has only etcd and control planes as roles. There are some DNS issues. This node was not able to resolve the domain name. image I was trying different combinations and observed that If I create the first node as all control,etcd and worker there is no such DNS isssue. I don’t know why this is working..:) The issue might be that when resolving the domain name to IP address it is only looking in the kubernetes DNS and not the global DNS. If you found a fix, please comment on this Issue-54.
  2. Error in Rancher UI -> "cattle-cluster-not-found"
    FIX: Go to settings -> scroll down and search for "telemetry-opt" -> Edit it -> from the drop-down chose "in".
Clone this wiki locally