Installation Guide for kubectl, oc, git, helm and ansible on MS Windows using WSL

Install WSL

  1. Open PowerShell as Administrator and run:
wsl --install

WSL will install a Ubuntu Linux distribution.

  1. Restart your computer if prompted.

Set up WSL

  1. Open WSL application, and provide default user and password
Ubuntu is already installed.
Starting Ubuntu...
...
Enter new UNIX username: demo
New password:
Retype new password:
passwd: password updated successfully

Install Packages

  1. Update and install packages
sudo apt -y update
sudo apt -y upgrade
  1. Install packages
sudo apt -y install ansible git openjdk-17-jre-headless python3-pip python3-kubernetes python3-requests python3-yaml
  1. Install kubectl and oc
curl -LO "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz"

tar -xzvf openshift-client-linux.tar.gz

chmod +x oc 
chmod +x kubectl

sudo mv oc kubectl /usr/local/bin/
  1. Install ansible kubernetes.core
ansible-galaxy collection install kubernetes.core

Install git, ansible, helm

  1. Add the Helm dependencies:
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list

sudo apt update
sudo apt install helm

Verify

  1. Verify the installation:
git --version
  1. Verify the installation:
oc version
  1. Verify the installation:
kubectl version
  1. Verify the installation:
ansible --version
  1. Verify the installation:
helm --version
  1. Verify the installation:
keytool