Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xynova/9014be71d6dcb19ae5e597a5cc3d6333 to your computer and use it in GitHub Desktop.
Save xynova/9014be71d6dcb19ae5e597a5cc3d6333 to your computer and use it in GitHub Desktop.
Installing Kubernetes and Docker tools on Windows 10 Ubuntu WSL

Installing Kubernetes and Docker tools on Windows 10 Ubuntu WSL

Enter a WSL ubuntu session

View details here: https://gist.github.com/xynova/87beae35688476efb2ee290d3926f5bb

From a Powershell session:

ubuntu

# ubuntu@windows10:~$

Install some useful tools

Install some utilities

sudo apt-get update -y && sudo apt-get install -y \
bash-completion \
nmap \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Get Kubectl

References:

Download the latest release with the command:

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

Make the kubectl binary executable and move it into the utilities path::

chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

Add the completion script to the /etc/bash_completion.d directory.

kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null

Force the creation of a temporary .kube config directory

kubectl config set-cluster fake --server=https://5.6.7.8 --insecure-skip-tls-verify
kubectl config set-credentials nobody 
kubectl config set-context fake --cluster=fake --namespace=default --user=nobody

Get Helm

References:

Install helm

curl -LO https://git.io/get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh

Add the completion script to the /etc/bash_completion.d directory.

helm completion bash | sudo tee /etc/bash_completion.d/helm > /dev/null

Install helm plugins: helm-github, helm-tiller, helm-restore

helm init --client-only
helm plugin install https://github.com/sagansystems/helm-github.git
helm plugin install https://github.com/rimusz/helm-tiller
helm plugin install https://github.com/maorfr/helm-restore

Get Kubectx and Kubens

References:

Get the kubectx script

curl -O https://raw.githubusercontent.com/ahmetb/kubectx/master/kubectx \
&& chmod +x kubectx \
&& sudo mv kubectx /usr/local/bin/

Get the kubens script

curl -O https://raw.githubusercontent.com/ahmetb/kubectx/master/kubens \
&& chmod +x kubens \
&& sudo mv kubens /usr/local/bin/

Add the completion script to the /etc/bash_completion.d directory.

BASE_URL=https://raw.githubusercontent.com/ahmetb/kubectx/master/completion
curl ${BASE_URL}/kubectx.bash | sudo tee /etc/bash_completion.d/kubectx > /dev/null
curl ${BASE_URL}/kubens.bash | sudo tee /etc/bash_completion.d/kubens > /dev/null

Get Docker cli and Docker Compose

References:

Remove older versions of Docker

sudo apt-get remove docker docker-engine docker.io containerd runc

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

Add Docker's stable repository

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Install Docker cli

sudo apt-get update -y && sudo apt-get install docker-ce-cli 

Update pip, install it if not present

pip --version || sudo apt-get install python-pip

Install Docker Compose

pip install --user docker-compose

Add the completion script to the /etc/bash_completion.d directory.

curl https://raw.githubusercontent.com/docker/compose/1.24.0/contrib/completion/bash/docker-compose \
| sudo tee /etc/bash_completion.d/docker-compose > /dev/null

Connecting Docker cli and Kubectl to Docker Desktop for Windows

View details here: https://gist.github.com/xynova/7d18ccb44eb52a38b5b51c0922e06cc7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment