top of page
Writer's pictureWilliam B

Tanzu Community Edition (TCE) Bootstrap VM / Jump Server Deployment Cheat Sheet

Updated: Jan 28, 2022

A few weeks ago VMware released Tanzu Community Edition, which is the free-ware version of their Kubernates platform. There is a lot of information out there regarding Tanzu so I will not go over the basics here, but their website has all the info you need:



The first step in setting up TCE is setting deploying a VM, which will be used to mount all of our Tanzu CLI tools and plugins. This bootstrap machine will be used to deploy the rest of the Kubernates infrastructure. I had to re-deploy this VM several times in order to get things to work properly.



Below is a consolidated list of steps that I took in order to build the bootstrap VM in a vSphere 6.7U3 lab environment.


Step 1.) Deploy Ubuntu VM

I used a Ubuntu 20.04 VM image with 2CPU`s, 8GB of RAM and a 30GB disk.

Step 2.) Resize VM storage using linux tools

When the VM is deployed, you may need to resize the storage volume in order to make space for all of the plugins and other Tanzu components. You should do this first to avoid running into installation problems down the line. Take a snapshot of the VM before performing the next operations.


A.) use df -h to locate storage volume

admin@tanzu-jumpsrvr01:~$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /dev
tmpfs                              797M  1.2M  796M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  6.9G  3.5G  3.1G  53% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2                          976M  200M  710M  22% /boot
/dev/loop1                          71M   71M     0 100% /snap/lxd/19647
/dev/loop0                          56M   56M     0 100% /snap/core18/2066
/dev/loop2                          56M   56M     0 100% /snap/core18/1997
/dev/loop3                          33M   33M     0 100% /snap/snapd/11588
/dev/loop5                          68M   68M     0 100% /snap/lxd/20326
/dev/loop4                          33M   33M     0 100% /snap/snapd/11841
tmpfs 


B.) Use fdisk to delete the partition, then n to create a new partition. Make sure to say no (N) to removing the signature. And then W to write the changes

admin@tanzu-jumpsrvr01:~$ fdisk /dev/sda

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/sda: Permission denied
admin@tanzu-jumpsrvr:~$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (16777215 != 62914559) will be corrected by write.

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 40876C5B-4B33-4AAA-A2DA-F91391E1971A

Device       Start      End  Sectors Size Type
/dev/sda1     2048     4095     2048   1M BIOS boot
/dev/sda2     4096  2101247  2097152   1G Linux filesystem
/dev/sda3  2101248 16775167 14673920   7G Linux filesystem

Command (m for help): d
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

Command (m for help): n
Partition number (3-128, default 3): 3
First sector (2101248-62914526, default 2101248):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-62914526, default 62914526):

Created a new partition 3 of type 'Linux filesystem' and of size 29 GiB.
Partition #3 contains a LVM2_member signature.

Do you want to remove the signature? [Y]es/[N]o: N

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 40876C5B-4B33-4AAA-A2DA-F91391E1971A

Device       Start      End  Sectors Size Type
/dev/sda1     2048     4095     2048   1M BIOS boot
/dev/sda2     4096  2101247  2097152   1G Linux filesystem
/dev/sda3  2101248 62914526 60813279  29G Linux filesystem

Command (m for help): w

The partition table has been altered.
Syncing disks.

admin@tanzu-jumpsrvr01:~$

C.) Use partx and pvresize to resize the physical volume

admin@tanzu-jumpsrvr01:~$ sudo pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized
admin@tanzu-jumpsrvr01:~$

Verify physical volume expansion with pvdisplay

admin@tanzu-jumpsrvr01:~$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               ubuntu-vg
  PV Size               <29.00 GiB / not usable 16.50 KiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              7423
  Free PE               5632
  Allocated PE          1791
  PV UUID               lQAcGS-gVOm-CcKb-uwZW-AOWS-DoLl-5Pe88w

admin@tanzu-jumpsrvr01:~$

D.) Use lvextend to expand the logical volume

admin@tanzu-jumpsrvr01:~$ sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <7.00 GiB (1791 extents) to <29.00 GiB (7423 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
admin@tanzu-jumpsrvr:~$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                Tt3Zqf-Jqe8-CinX-qHXR-L0yx-Zqxj-kkR1ho
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-04-18 15:44:00 +0000
  LV Status              available
  # open                 1
  LV Size                <29.00 GiB
  Current LE             7423
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

admin@tanzu-jumpsrvr01:~$

E.) Extend the EXT filesystem

admin@tanzu-jumpsrvr01:~$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 7601152 (4k) blocks long.

admin@tanzu-jumpsrvr01:~$

F.) Use df -h to verify successful disk expansion

admin@tanzu-jumpsrvr01:~$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /dev
tmpfs                              797M  1.2M  796M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   29G  3.5G   24G  13% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2                          976M  200M  710M  22% /boot
/dev/loop1                          71M   71M     0 100% /snap/lxd/19647
/dev/loop0                          56M   56M     0 100% /snap/core18/2066
/dev/loop2                          56M   56M     0 100% /snap/core18/1997
/dev/loop3                          33M   33M     0 100% /snap/snapd/11588
/dev/loop5                          68M   68M     0 100% /snap/lxd/20326
/dev/loop4                          33M   33M     0 100% /snap/snapd/11841
tmpfs                              797M     0  797M   0% /run/user/1000
admin@tanzu-jumpsrvr01:~$

Step 3.) Install Docker


A.) Add Docker’s official GPG key:

sudo apt-get update

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

B.) Use the following command to set up the stable repository.

 echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

C.) Install Docker

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

D.) Setup Docker to run as a non-root user

sudo groupadd docker
sudo usermod -aG docker admin

Logout of the VM and log back in as the regular (non-sudo) user.


E.) Verify that you can run Docker as non-root user

docker run hello-world

Step 4.) Install Build-essential, GIT, Brew & GCC

sudo apt update
sudo apt-get install build-essential
sudo apt install git -y
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the instructions as listed in the output:


Verify Brew and install GCC:

brew doctor
brew install gcc

Step 5.) Install Tanzu

brew tap vmware-tanzu/tanzu
brew install tanzu-community-edition

/home/linuxbrew/.linuxbrew/Cellar/tanzu-community-edition/v0.9.1/libexec/configure-tce.sh

Step 6.) Install Kubectl

curl -LO https://dl.k8s.io/release/v1.21.2/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

Step 7.) Install KIND


(Find your $PATH: echo $PATH)

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
mv ./kind /some-dir-in-your-PATH/kind

Step 8.) Configure SSH


A.) Generate SSH keys, but sure to not save the file in the default directory (root) but in your regular user directory.

cd /home/admin/.ssh
admin@tanzu-jumpsrvr01:~/.ssh$ sudo ssh-keygen -t rsa -b 4096 -C “email@company.com”
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /home/admin/.ssh/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin/.ssh/id_rsa
Your public key has been saved in /home/admin/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:Q02askDxFId8BA1r78FB/v/42/JCGd8HYYaLdt+LLNl “email@company.com”
The key's randomart image is:
+---[RSA 4096]----+
|           .++  |
|         .  +*o  |
|        . o.++o  |
|       .  o**oo |
|        S.o+.o+*o|
|         o . o+.*|
|          . B.o +|
|           = Eoo|
|            o .**|
+----[SHA256]-----+

B.) Add your SSH identity created above to your key-chain

admin@tanzu-jumpsrvr01:~/.ssh$ sudo ssh-agent /bin/sh
# ssh-add /home/admin/.ssh/id_rsa
Enter passphrase for /home/admin/.ssh/id_rsa:
Identity added: /home/admin/.ssh/id_rsa (“email@company.com”)
# exit

C.) You can view the key information in the /.ssh directory

admin@tanzu-jumpsrvr01:~/.ssh$ cat id_rsa.pub

Step 9.) Run Tanzu Installer

tanzu management-cluster create --ui --bind YOUR_VM_IP:8080 --browser none

This will start the GUI installer.

The Tanzu Community website has detailed most of the configuration steps beyond this point, but one thing I wanted to comment regarding the SSH public key area in the cluster installer.


Step 10.) Add SSH Public Key

When connecting to the vCenter, you add the public key that we made in step 8 above (id_rsa.pub) in the configuration box below.



Conclusion:


TCE is a nice way to get hands on experience and exposure to k8s clusters and associated technologies. This post was meant to provide some tips that can assist with a smoother installation and can help with getting things up faster. Please refer to https://tanzucommunityedition.io/ for more details.






348 views0 comments

Comments


bottom of page