Blog Date: August 8, 2022
vSphere version 7.0.3 Build 20150588
On engagements with customers, I’ll have them deploy a developer VM where we can work and I can get them started on their Tanzu and Kubernetes journey. This one VM will have docker, docker credential helper, and the Tanzu Kubernetes CLI installed. For the purpose of this blog series, I’ll do the same. For this blog, I’ll walk through the process using Ubuntu 22.04. In my lab, I have already configured my Ubuntu VM with a static IP and host name.
Getting Started with Ubuntu and Installing Docker
Docker is available for download and installation on Ubuntu 22.04. To get started, let’s update the package repo first, and then we can install docker.
$ sudo apt update $ sudo apt install docker.io
After the Docker installation has completed successfully, let’s start the Docker service, and enable it to run on boot.
$ sudo systemctl start docker $ sudo systemctl enable docker.service
(Optional) Once that completes, run the following commands to allow docker to run as non-root:
$ sudo groupadd docker $ sudo usermod -aG docker $USER $ sudo newgrp docker
Let’s run the following command to see the Docker path. We should get a return /usr/bin/docker
$ which docker
Let’s make sure Docker is running with the following command.
$ sudo systemctl status docker
We should see an active (running) status.
You can verify the current Docker version installed, and see additional details with the following command.
$ sudo docker version
At this point, my customer would have completed to per-requisite to have an Ubuntu VM deployed for me. In this blog however, I will continue on assuming vSphere with Tanzu has already been enabled on a workload cluster in the environment.
Downloading The Kubernetes CLI vsphere-plugin.zip
The official VMware guide to Download and Install the Kubernetes CLI Tools for vSphere can be found here. In the vSphere Client, click the 3 hash marks in the upper left and select Workload Management. Select the Supervisor Clusters tab. Make note of the Control Plane Node Address (IP address). It will be needed for the next command to download the vsphere-plugin.zip.
In the example command, I am using the optional –no-check-certificate. Replace the IP address with your Control Plane Node IP Address
$ wget https://192.168.6.13/wcp/plugin/linux-amd64/vsphere-plugin.zip --no-check-certificate
Next, let’s unzip the vsphere-plugin.zip to /usr/bin/vsphere-plugin
$ sudo unzip vsphere-plugin.zip -d /usr/bin/vsphere-plugin
VMware does provide instructions on the control plane node landing page, if you open a web browser and go to https://<insert_control_plane_node_ip_address_here >
We are up to step 2, and we need to put the contents of the unzipped vsphere-plugin into your executable search path. Let’s execute the following commands.
$ echo 'export PATH=$PATH:/usr/bin/vsphere-plugin/bin' >> ~/.bash_profile $ echo 'source <(kubectl completion bash)' >> ~/.bash_profile
Next, we’ll exit our current SSH session on the ubuntu dev vm.
Now re-establish a SSH session to the ubuntu dev vm using the same account as before. Once logged in, let’s test that kubectl completion bash is working. We do this by entering ‘kubectl’ followed by a space and then hit tab twice.
Test Connection to Tanzu Control plane (optional)
From the Ubuntu dev VM, use the kubectl CLI to connect to the vSphere with Tanzu control plane as the authenticated user. Here I am using the –insecure-skip-tls-verify optional parameter
$ kubectl vsphere login --server <cluster_ip> --insecure-skip-tls-verify
It will prompt for a username and password. Once successfully logged in and if the account you chose has permissions to access the Tanzu control plane node, you should see a message stating you have access to the following contexts.
Now you are ready to begin working with Tanzu. More content to come. Stay tuned.