To install kubectl without using sudo on Ubuntu 22, you can follow these steps:


Download kubectl binary:
Open a terminal and use `curl` to download the kubectl binary from the official Kubernetes repository. Make sure to download the appropriate version for your platform (e.g., 64-bit Linux):

curl -LO "$(curl -Ls"


Create a local bin directory:
Next, create a local `bin` directory in your home folder where you'll store the kubectl binary:

mkdir -p ~/bin

Move the kubectl binary to the local bin directory:
Move the downloaded kubectl binary to the bin directory you just created:

mv kubectl ~/bin/


Update your PATH
You need to add the local bin directory to your PATH environment variable so that you can run kubectl from any location. Edit your .bashrc or .bash_profile (depending on your setup) to add the following line:

export PATH=$HOME/bin:$PATH

Save the file and then execute it to apply the changes to the current terminal session:

source ~/.bashrc


Verify kubectl installation
You should now be able to run kubectl without using sudo

kubectl version --client

This command should display the version of kubectl you installed.


Remember to check for the latest kubectl version before downloading it, as newer releases might become available over time.

For more information on this visit the kubernetes website.