1-a: Create environment: Install Minikube in Windows 11 (WSL2.0 + Ubuntu22.04)
Install WSL2.0 with Windows Command Prompt or PowerShell
wsl --install
Install Ubuntu 22.04
wsl --list --online wsl --install -d Ubuntu22.04 sudo apt update sudo apt upgrade
wsl --list --online
This command is used in Windows Subsystem for Linux (WSL), a compatibility layer for running Linux binary executables natively on Windows.
--list
is an option to display a list of installed Linux distributions.--online
is an option to show distributions available for download from the Microsoft Store.
wsl --install -d Ubuntu22.04
--install
is an option to install a new Linux distribution.-d
specifies the distribution to be installed, in this case, "Ubuntu22.04."
sudo apt update
This command is used in a Linux environment, typically in Debian-based distributions like Ubuntu.
sudo
stands for "superuser do" and is used to execute commands with elevated privileges.apt
is the package management tool.update
is a command that refreshes the local package database, ensuring you have the latest information about available packages.
sudo apt upgrade
upgrade
is a command that installs the latest versions of the installed packages on your system.It is common to run
apt update
beforeapt upgrade
to ensure that the package information is up-to-date.
Install Docker engine
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done sudo apt-get update sudo apt-get install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo docker run hello-world
See: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
- This loop iterates over a list of packages related to containerization tools (like Docker and Podman) and removes them using the
sudo apt-get remove
command.
- This loop iterates over a list of packages related to containerization tools (like Docker and Podman) and removes them using the
sudo apt-get update
- This command updates the package information on your system, ensuring you have the latest details about available packages.
sudo apt-get install ca-certificates curl GnuPG
- This installs essential tools (
ca-certificates
,curl
, andgnupg
) needed to securely handle certificates, download files, and manage cryptographic keys.
- This installs essential tools (
sudo install -m 0755 -d /etc/apt/keyrings
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
- This creates a directory for keyrings, downloads Docker's GPG key, converts it into the required format, and sets the necessary permissions.
echo "deb [arch="$(dpkg --print-architecture)" ....
- This command adds Docker's official repository to the list of package sources, specifying the architecture and GPG key for verification.
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- This installs Docker, Docker CLI, Containerd (core container runtime), and additional plugins (
docker-buildx-plugin
anddocker-compose-plugin
).
- This installs Docker, Docker CLI, Containerd (core container runtime), and additional plugins (
sudo docker run hello-world
- Finally, this command pulls the "hello-world" Docker image and runs a container to verify that Docker is installed and working correctly.
Install Docker Compose
sudo -i curl -L https://github.com/docker/compose/releases/download/1.6.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose exit docker-compose --version
sudo -i
- This command elevates the user's privileges to the root user, providing an interactive root shell.
curl -L https://github.com/docker/compose/releases/download/1.6.2/docker-compose-
uname
-s
-uname -m
> /usr/local/bin/docker-compose- This uses
curl
to download the Docker Compose binary for a specific release (1.6.2 in this case) based on the current system's architecture and operating
- This uses
chmod +x /usr/local/bin/docker-compose
- This command adds the execute permission to the downloaded Docker Compose binary, making it executable.
exit
- This command exits the root shell, returning to the previous user's shell.
docker-compose --version
- Finally, this command checks the version of Docker Compose installed on the system. It prints out the version information to confirm a successful installation.
Install Minikube
See: https://minikube.sigs.k8s.io/docs/start/
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube sudo usermod -aG docker $USER && newgrp docker minikube start --driver=docker
Install kubectl
sudo snap install --classic kubectl
snap
is the command-line interface for the Snap package manager.install
is the subcommand used to install a Snap package.--classic
flag is used to indicate that the Snap package requires classic confinement, which provides full access to the system.kubectl
is the name of the Snap package being installed.
Install Helm
https://helm.sh/docs/intro/install/
wget https://get.helm.sh/helm-v3.12.3-linux-amd64.tar.gz tar xvfz helm-v3.12.3-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/helm
Additional notes: Basic commands to operate Minikube
Start Minikube with static IP
- minikube start --driver docker --static-ip=xxx.xxx.xxx.xxx
Delete a cluster in Minikube
- minikube delete
Stop Minikube
- minikube stop