Sunday, March 27, 2022

[lunar.lab] Prepare Bootstrap Machine for TKGm Deployment

Having a bootstrap machine is one of the step required for deploying TKGm to vSphere as stated here:

https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.5/vmware-tanzu-kubernetes-grid-15/GUID-mgmt-clusters-vsphere.html

This article will run through the step I took to configure that bootstrap machine which involves these following 4 steps.


Step 1 - Starting Point: Ubuntu VM

I create Ubuntu VM from scratch with the following configuration:

  • Virtual Hardware specification
    • 8 vCPU
    • 8GB RAM
    • 40GB disk
  • Ubuntu 20.04
  • Minimum install + OpenSSH
  • Configure static IP
  • Configure Internet access (using proxy)
Once VM created on vSphere, boot from Ubuntu 20.04 installation image, then all the above settings can be configured easily through the installation wizard. Pretty straightforward.

Step 2 - Install Tanzu CLI and Other Tools

Reference:

https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.5/vmware-tanzu-kubernetes-grid-15/GUID-install-cli.html

Download Tanzu CLI and kubectl for Linux installation file as described in the above reference. In my case I downloaded those files to my Windows machine, create a folder named tanzu in my Ubuntu VM home directory, and then transfer those files to tanzu folder using WinSCP.

From this point forward, these are the command I run on Ubuntu VM.

Decompress Tanzu CLI and kubectl installation file:

cd $HOME/tanzu
tar -xvf tanzu-cli-bundle-linux-amd64.151.tar.gz
gzip -d kubectl-linux-v1.22.5+vmware.1.gz

Install Tanzu CLI and plugins, confirm Tanzu CLI installation:

cd cli
sudo install core/v0.11.1/tanzu-core-linux_amd /usr/local/bin/tanzu
tanzu init
tanzu version
tanzu plugin clean
tanzu plugin sync
tanzu plugin list

Install kubectl and confirm kubectl installation:

cd $HOME/tanzu
chmod ugo+x kubectl-linux-v1.22.5+vmware.1
sudo install kubectl-linux-v1.22.5+vmware.1 /usr/local/bin/kubectl
kubectl version

Decompress Carvel Tools:

cd $HOME/tanzu/cli
gunzip ytt-linux-amd64-v0.34.0+vmware.1.gz
gunzip kapp-linux-amd64-v0.37.0+vmware.1.gz
gunzip kbld-linux-amd64-v0.30.0+vmware.1.gz
gunzip imgpkg-linux-amd64-v0.10.0+vmware.1.gz

Install Carvel Tools:

chmod ugo+x ytt-linux-amd64-v0.34.0+vmware.1
chmod ugo+x kapp-linux-amd64-v0.37.0+vmware.1
chmod ugo+x kbld-linux-amd64-v0.30.0+vmware.1
chmod ugo+x imgpkg-linux-amd64-v0.10.0+vmware.1
sudo mv ./ytt-linux-amd64-v0.34.0+vmware.1 /usr/local/bin/ytt
sudo mv ./kapp-linux-amd64-v0.37.0+vmware.1 /usr/local/bin/kapp
sudo mv ./kbld-linux-amd64-v0.30.0+vmware.1 /usr/local/bin/kbld
sudo mv ./imgpkg-linux-amd64-v0.10.0+vmware.1 /usr/local/bin/imgpkg

Confirm Carvel Tools installation:

ytt version
kapp version
kbld version
imgpkg version

Step 3 - Create SSH Key Pair

Reference:

https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.5/vmware-tanzu-kubernetes-grid-15/GUID-mgmt-clusters-vsphere.html#create-an-ssh-key-pair-7

The following command will create SSH Key Pair in $HOME/.ssh directory. Public key will be saved as $HOME/.ssh/id_rsa.pub. I copied this file to my Windows machine as I will need this when deploying TKGm management cluster.

cd $HOME/
ssh-keygen -t rsa -b 4096 -C "lunarlab@corp.local"
ssh-agent /bin/sh
ssh-add ~/.ssh/id_rsa
exit
eval 'ssh-agent -s'


Step 4 - Install Docker

Reference:

Set up Docker repository and then install Docker engine:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Manage Docker as a non-root user:
sudo groupadd docker
sudo usermod -aG docker $USER
sudo reboot
Ensure bootstrap machine is using cgroups v1:
docker info | grep -i cgroup
This is the example result:
Cgroup Driver: cgroupfs
Cgroup Version: 1
WARNING: No swap limit support

Now my bootstrap machine is ready and look out for this page for the next step. Thanks for reading.

------------------------------------------------------
This article is second part of Deploying VMware Tanzu Kubernetes Grid on vSphere blog series.

No comments:

Post a Comment