Kubernetes Homelab – New Cluster with vSphere CSI

From the previous post we have successfully set up the ubuntu VM template, deployed Rancher, and set up the requirements to deploy our template from Rancher along with the vSphere CPI/CSI – it’s now time to deploy the first cluster!

The first thing that needs done is going to Apps from the Rancher top menu and clicking on Launch. The VMware vSphere CPI CSI will be shown at the top of the catalog.

Expand the Detailed Descriptions section, and scroll down to Manual steps, new cluster. We will follow the instructions listed:

  • Create a new cluster with External cloud provider selected.
  • Paste the code listed into the kubelet configuration yaml.
  • Finish cluster creation.
  • Return to the vSphere CPI/CSI App and deploy into the kube-system namespace in the new cluster.

For now, I’m going to copy the code listed so I can paste into my new cluster.

Creating the first cluster

From the Rancher main page, click on Add Cluster. Then, select vSphere under the Create a new Kubernetes cluster section.

Now give the cluster a name, in my case “tsmith-k8s” and choose how to divide up the cluster. I’m going to choose 1 management node and 3 worker nodes.

On the first node, input the name prefix – “tsmith-mgmt” – and select the node template previously created in the drop down list. Select the etcd and Control Plane checkboxes, and clear the worker check box. Next, click Add Node Pool and input a name for the worker nodes, “tsmith-wkr”. I’ve increased this count to 3, selected the same node template, and reversed my checkboxes so that only Worker is checked.

Under Kubernetes Options there’s the ability to change the kubernetes version, as well as change the network provider, however, I’m going to stick with the defaults. The only thing to change is to select the radio button External under In-Tree Cloud Provider. The GUI will instruct us to now edit the YAML. Scrolling up just a little we can see the Edit as YAML button to click, then paste the code at the bottom of the YAML.

Click CREATE to start the deployment! At this point, Rancher will instruct vSphere to deploy 4 VMs from the Ubuntu template, and will customize according to the node template properties. Everything needed to run a Kubernetes cluster will be deployed into the nodes. An Provisioning message will be shown in the Clusters view until all nodes are deployed, and kubernetes is configured and accessible on the new cluster.

Depending on storage, this could take a couple minutes. Once our cluster reaches an Active state, the last step is to deploy the vSphere CSI App into the cluster.

Once the cluster state is Active, click on APPS on the menu bar, and select LAUNCH. Here we will select out vSphere-CSI helmv3 chart that we added previously.

Give the app a name, tsmith-k8s-csi in my case, and then choose the target project from the drop down list: tsmith-k8s cluster, and system.

Under the ROLES section, select the radio button for Cluster. Then, scroll down and enter in the relevant vSphere information:

  • vCenter name
  • vCenter username
  • vCenter password
  • Data Center
  • Storage Policy Name

Click Launch at the bottom of the screen to deploy this into your cluster. The cluster name will change from blue to green once the CSI is installed in the cluster.

To verify we have a storage class setup within the cluster using that CSI, select the cluster from the Global drop down menu. Then select the Launch kubectl button to access the cli on the browser. At the prompt, type:

kubectl get storageclasses

The new storage class was created successfully, is now default, and uses the vSphere CSI. Continuing this series, the following posts will cover adding this cluster into the kubeconfig, installing some sample apps, installing Kasten K10 to backup our stateful workloads, and finally using K10 to recover those workloads. Stay tuned!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.