How to: Setup Kubernetes on your workstation

There are a lot of good guides for this around but I wanted to write this to have my own with all the commands needed in one location. This guide is for developers working with Kubernetes and is designed to setup your workstation with all the tools you need to work with Kubernetes. I will include the links for other OSs but the guide is for Linux.

  1. Install Docker

Docker Desktop/Engine for Mac
Docker Desktop/Engine for Windows
Docker Desktop/Engine for Linux

#Uninstall old versions
sudo apt-get remove docker docker-engine docker.io containerd runc
#Set up the repository
 sudo apt-get update
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
sudo mkdir -p /etc/apt/keyrings
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

#Install Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
apt-cache madison docker-ce
docker-compose-plugin

# Test with hello world image that everything is working
docker run hello-world
# Remove image after check
docker rmi hello-world

#Manage Docker as a non-root user
sudo groupadd docker
sudo usermod -aG docker $USER
#Log out and log back in so that your group membership is re-evaluated
newgrp docker
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

#Configure Docker to start on boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service

#Check the version
docker Version

The results should be something like this

2. Install Kind (Kubernetes in Docker)

Kind Docs

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.14.0/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin
which kind 
kind version

3. Install kubectl
kubectl Docs

# Install using native package management
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

#See version
kubectl version --client

4. Install kustomize

Kustomize Docs

curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash

5. Install Helm

Helm Docs

curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get 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-get update
sudo apt-get install helm
helm version

6. Install Skaffold

Skaffold docs

curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
skaffold version

This should be all tools you need to start building and running container images on your workstation

You May Also Like

About the Author: Phil

Leave a Reply

Your email address will not be published. Required fields are marked *