how to install kubectl on ubuntu 20.04 instance code example

Example 1: kubectl install ubuntu 20.04

sudo apt update
sudo apt -y install curl apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install kubectl

Example 2: installing kubernetes on ubuntu 20.04

sudo apt update
sudo apt -y upgrade && sudo systemctl reboot