Install Docker and Minikube in Windows Subsystem for Linux (WSL)

Install Docker and Minikube in Windows Subsystem for Linux (WSL)

·

16 min read

How to Install Minikube on Ubuntu WSL2 ?

Minikube is a lightweight Kubernetes implementation that makes it easy to set up a local Kubernetes cluster for development and testing. If you're using Ubuntu on WSL2, follow this step-by-step guide to install and configure Minikube.


Step 1: Prerequisites

Before you begin, ensure you have the following:

  • Ubuntu installed on WSL2.

  • Administrative privileges.

  • Docker installed and running. If you haven't installed Docker yet, follow the Docker installation guide.

To install Docker Engine on Ubuntu using the apt repository, follow these steps:


1. Set up Docker's apt repository

Step 1.1: Update the package list and install prerequisites.

bashCopyEditsudo apt-get update
sudo apt-get install -y ca-certificates curl

Step 1.2: Create a directory for Docker's GPG key and download it.

bashCopyEditsudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Step 1.3: Add the Docker repository to your system's sources list.

bashCopyEditecho \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 1.4: Update the package list to include the Docker repository.

bashCopyEditsudo apt-get update

2. Install Docker packages

Install Docker Engine, CLI, and additional plugins.

bashCopyEditsudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3. Check the status of Docker

Verify that the Docker service is running.

bashCopyEditsudo service docker status

4. Verify the installation

Run the hello-world image to confirm Docker is working.

bashCopyEditsudo docker run hello-world

5. Resolve "permission denied" for non-root users

If you encounter a "permission denied" error when running Docker commands (docker ps, etc.), follow these steps:

Step 5.1: Create the docker group (if it doesn't already exist).

bashCopyEditsudo groupadd docker

Step 5.2: Add your user to the docker group.

bashCopyEditsudo usermod -aG docker $USER

Step 5.3: Log out and log back in for the group changes to take effect.

Step 5.4: Test Docker without sudo.

bashCopyEditdocker ps

6. Additional Notes

  • To apply changes without logging out, you can run:

      bashCopyEditnewgrp docker
    
  • Ensure your system is up-to-date to avoid compatibility issues:

      bashCopyEditsudo apt-get update && sudo apt-get upgrade -y
    

Now you should have Docker installed and running on your Ubuntu system!

Step 2: Install Minikube

Download and Install Minikube

1. Install Minikube

  1. Download the latest Minikube stable release:

     bashCopyEditcurl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
    
  2. Install the downloaded Debian package:

     bashCopyEditsudo dpkg -i minikube_latest_amd64.deb
    

    2. Start Your Cluster

    1. Run the following command to start Minikube:

       bashCopyEditminikube start
      
    2. If Minikube fails to start, refer to the Minikube Drivers Page to set up a compatible container or virtual-machine manager.


3. Interact with Your Cluster

  1. If you already have kubectl installed, you can interact with the cluster:

     bashCopyEditkubectl get po -A
    
  2. Alternatively, Minikube can download and use the appropriate version of kubectl:

     bashCopyEditminikube kubectl -- get po -A
    
  3. To simplify future commands, you can add this alias to your shell configuration:

     bashCopyEditalias kubectl="minikube kubectl --"
    
  4. To access the Kubernetes Dashboard:

     bashCopyEditminikube dashboard
    

4. Deploy Applications

  1. Create a sample deployment:

     bashCopyEditkubectl create deployment hello-minikube --image=kicbase/echo-server:1.0
    
  2. Expose the deployment on port 8080:

     bashCopyEditkubectl expose deployment hello-minikube --type=NodePort --port=8080
    
  3. Check the service status:

     bashCopyEditkubectl get services hello-minikube
    
  4. To access the service, let Minikube open a browser for you:

     bashCopyEditminikube service hello-minikube
    
  5. Alternatively, forward the port manually:

     bashCopyEditkubectl port-forward service/hello-minikube 7080:8080
    

    Access your application at http://localhost:7080/.


5. Manage Your Cluster

  • Pause Kubernetes without impacting deployed applications:

      bashCopyEditminikube pause
    
  • Unpause the cluster:

      bashCopyEditminikube unpause
    
  • Stop the cluster:

      bashCopyEditminikube stop
    
  • Change the default memory limit (requires a restart):

      bashCopyEditminikube config set memory 9001
    
  • Browse the catalog of available Kubernetes services:

      bashCopyEditminikube addons list
    
  • Create a second cluster with an older Kubernetes release:

      bashCopyEditminikube start -p aged --kubernetes-version=v1.16.1
    
  • Delete all Minikube clusters:

      bashCopyEditminikube delete --all
    

You now have Minikube installed and configured, ready to explore Kubernetes locally!

Hands on parts

root@DESKTOP-R12R5NH:/# whoami
root
root@DESKTOP-R12R5NH:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
root@DESKTOP-R12R5NH:/# pwd
/
root@DESKTOP-R12R5NH:/# sudo apt-get update
Get:1 https://download.docker.com/linux/ubuntu jammy InRelease [48.8 kB]
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Err:1 https://download.docker.com/linux/ubuntu jammy InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
W: GPG error: https://download.docker.com/linux/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@DESKTOP-R12R5NH:/# sudo apt-get install ca-certificates curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20240203~22.04.1).
curl is already the newest version (7.81.0-1ubuntu1.20).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@DESKTOP-R12R5NH:/# sudo install -m 0755 -d /etc/apt/keyrings
root@DESKTOP-R12R5NH:/# sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
root@DESKTOP-R12R5NH:/# sudo chmod a+r /etc/apt/keyrings/docker.asc
root@DESKTOP-R12R5NH:/# echo \
>   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
>   $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
>   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
root@DESKTOP-R12R5NH:/# sudo apt-get update
Get:1 https://download.docker.com/linux/ubuntu jammy InRelease [48.8 kB]
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:5 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [43.3 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [2041 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [960 kB]
Fetched 3478 kB in 6s (600 kB/s)
Reading package lists... Done
root@DESKTOP-R12R5NH:/# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  dbus-user-session docker-ce-rootless-extras libltdl7 libslirp0 pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io dbus-user-session docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras
  docker-compose-plugin libltdl7 libslirp0 pigz slirp4netns
0 upgraded, 11 newly installed, 0 to remove and 5 not upgraded.
Need to get 124 MB of archives.
After this operation, 448 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://download.docker.com/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.7.25-1 [29.6 MB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/universe amd64 pigz amd64 2.6-1 [63.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 dbus-user-session amd64 1.12.20-2ubuntu4.1 [9442 B]
Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 libltdl7 amd64 2.4.6-15build2 [39.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 libslirp0 amd64 4.6.1-1build1 [61.5 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/universe amd64 slirp4netns amd64 1.0.1-2 [28.2 kB]
Get:7 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-buildx-plugin amd64 0.19.3-1~ubuntu.22.04~jammy [30.7 MB]
Get:8 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-ce-cli amd64 5:27.5.0-1~ubuntu.22.04~jammy [15.2 MB]
Get:9 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-ce amd64 5:27.5.0-1~ubuntu.22.04~jammy [26.1 MB]
Get:10 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-ce-rootless-extras amd64 5:27.5.0-1~ubuntu.22.04~jammy [9589 kB]
Get:11 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-compose-plugin amd64 2.32.4-1~ubuntu.22.04~jammy [12.8 MB]
Fetched 124 MB in 25s (4987 kB/s)
Selecting previously unselected package pigz.
(Reading database ... 42578 files and directories currently installed.)
Preparing to unpack .../00-pigz_2.6-1_amd64.deb ...
Unpacking pigz (2.6-1) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../01-containerd.io_1.7.25-1_amd64.deb ...
Unpacking containerd.io (1.7.25-1) ...
Selecting previously unselected package dbus-user-session.
Preparing to unpack .../02-dbus-user-session_1.12.20-2ubuntu4.1_amd64.deb ...
Unpacking dbus-user-session (1.12.20-2ubuntu4.1) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../03-docker-buildx-plugin_0.19.3-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-buildx-plugin (0.19.3-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../04-docker-ce-cli_5%3a27.5.0-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-cli (5:27.5.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../05-docker-ce_5%3a27.5.0-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce (5:27.5.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../06-docker-ce-rootless-extras_5%3a27.5.0-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-rootless-extras (5:27.5.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../07-docker-compose-plugin_2.32.4-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-compose-plugin (2.32.4-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../08-libltdl7_2.4.6-15build2_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-15build2) ...
Selecting previously unselected package libslirp0:amd64.
Preparing to unpack .../09-libslirp0_4.6.1-1build1_amd64.deb ...
Unpacking libslirp0:amd64 (4.6.1-1build1) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../10-slirp4netns_1.0.1-2_amd64.deb ...
Unpacking slirp4netns (1.0.1-2) ...
Setting up dbus-user-session (1.12.20-2ubuntu4.1) ...
Setting up docker-buildx-plugin (0.19.3-1~ubuntu.22.04~jammy) ...
Setting up containerd.io (1.7.25-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.Setting up docker-compose-plugin (2.32.4-1~ubuntu.22.04~jammy) ...
Setting up libltdl7:amd64 (2.4.6-15build2) ...
Setting up docker-ce-cli (5:27.5.0-1~ubuntu.22.04~jammy) ...
Setting up libslirp0:amd64 (4.6.1-1build1) ...
Setting up pigz (2.6-1) ...
Setting up docker-ce-rootless-extras (5:27.5.0-1~ubuntu.22.04~jammy) ...
Setting up slirp4netns (1.0.1-2) ...
Setting up docker-ce (5:27.5.0-1~ubuntu.22.04~jammy) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
root@DESKTOP-R12R5NH:/# sudo service docker status
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2025-01-21 23:17:11 IST; 57s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 4417 (dockerd)
      Tasks: 10
     Memory: 26.3M
     CGroup: /system.slice/docker.service
             └─4417 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jan 21 23:17:08 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:08.126857632+05:30" level=info msg="Loading conta>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.306158342+05:30" level=info msg="Loading conta>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.517213529+05:30" level=warning msg="WARNING: N>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.517486651+05:30" level=warning msg="WARNING: N>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.517584031+05:30" level=warning msg="WARNING: N>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.517665280+05:30" level=warning msg="WARNING: N>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.517790540+05:30" level=info msg="Docker daemon>Jan 21 23:17:10 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:10.519188808+05:30" level=info msg="Daemon has co>Jan 21 23:17:11 DESKTOP-R12R5NH dockerd[4417]: time="2025-01-21T23:17:11.443459350+05:30" level=info msg="API listen on>Jan 21 23:17:11 DESKTOP-R12R5NH systemd[1]: Started Docker Application Container Engine.

root@DESKTOP-R12R5NH:/# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:1b7a37f2a0e26e55ba2916e0c53bfbe60d9bd43e390e31aacd25cb3581ed74e6
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

root@DESKTOP-R12R5NH:/# sudo groupadd docker
groupadd: group 'docker' already exists
root@DESKTOP-R12R5NH:/# sudo usermod -aG docker $USER
root@DESKTOP-R12R5NH:/# newgrp docker
root@DESKTOP-R12R5NH:/# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
root@DESKTOP-R12R5NH:/# docker image

Usage:  docker image COMMAND

Manage images

Commands:
  build       Build an image from a Dockerfile
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Display detailed information on one or more images
  load        Load an image from a tar archive or STDIN
  ls          List images
  prune       Remove unused images
  pull        Download an image from a registry
  push        Upload an image to a registry
  rm          Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

Run 'docker image COMMAND --help' for more information on a command.
root@DESKTOP-R12R5NH:/# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    d2c94e258dcb   21 months ago   13.3kB
root@DESKTOP-R12R5NH:/# curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0    282      0 --:--:-- --:--:-- --:--:--   283
100 54.6M  100 54.6M    0     0  3227k      0  0:00:17  0:00:17 --:--:-- 4956k
root@DESKTOP-R12R5NH:/# curl -LO https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0    370      0 --:--:-- --:--:-- --:--:--   369
100 54.6M  100 54.6M    0     0  4532k      0  0:00:12  0:00:12 --:--:-- 4404k
root@DESKTOP-R12R5NH:/# curl -LO https://dl.k8s.io/release/v1.32.0/bin/linux/arm64/kubectl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0    207      0 --:--:-- --:--:-- --:--:--   207
100 53.2M  100 53.2M    0     0  4168k      0  0:00:13  0:00:13 --:--:-- 5280k
root@DESKTOP-R12R5NH:/# curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0    365      0 --:--:-- --:--:-- --:--:--   365
100    64  100    64    0     0     89      0 --:--:-- --:--:-- --:--:--    89
root@DESKTOP-R12R5NH:/# sudo apt-get update
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
root@DESKTOP-R12R5NH:/# sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20240203~22.04.1).
curl is already the newest version (7.81.0-1ubuntu1.20).
gnupg is already the newest version (2.2.27-3ubuntu2.1).
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 1510 B of archives.
After this operation, 170 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 apt-transport-https all 2.4.13 [1510 B]
Fetched 1510 B in 1s (2419 B/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 42856 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.4.13_all.deb ...
Unpacking apt-transport-https (2.4.13) ...
Setting up apt-transport-https (2.4.13) ...
root@DESKTOP-R12R5NH:/# curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
root@DESKTOP-R12R5NH:/# sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
root@DESKTOP-R12R5NH:/# echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /
root@DESKTOP-R12R5NH:/# sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list
root@DESKTOP-R12R5NH:/# sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:6 https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.32/deb  InRelease [1186 B]
Get:7 https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.32/deb  Packages [3954 B]
Fetched 5140 B in 13s (394 B/s)
Reading package lists... Done
root@DESKTOP-R12R5NH:/# sudo apt-get install -y kubectl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  kubectl
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 11.3 MB of archives.
After this operation, 57.4 MB of additional disk space will be used.
Get:1 https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.32/deb  kubectl 1.32.1-1.1 [11.3 MB]
Fetched 11.3 MB in 5s (2237 kB/s)
Selecting previously unselected package kubectl.
(Reading database ... 42860 files and directories currently installed.)
Preparing to unpack .../kubectl_1.32.1-1.1_amd64.deb ...
Unpacking kubectl (1.32.1-1.1) ...
Setting up kubectl (1.32.1-1.1) ...
root@DESKTOP-R12R5NH:/# kubectl
kubectl controls the Kubernetes cluster manager.

 Find more information at: https://kubernetes.io/docs/reference/kubectl/

Basic Commands (Beginner):
  create          Create a resource from a file or from stdin
  expose          Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
  run             Run a particular image on the cluster
  set             Set specific features on objects

Basic Commands (Intermediate):
  explain         Get documentation for a resource
  get             Display one or many resources
  edit            Edit a resource on the server
  delete          Delete resources by file names, stdin, resources and names, or by resources and label selector

Deploy Commands:
  rollout         Manage the rollout of a resource
  scale           Set a new size for a deployment, replica set, or replication controller
  autoscale       Auto-scale a deployment, replica set, stateful set, or replication controller

Cluster Management Commands:
  certificate     Modify certificate resources
  cluster-info    Display cluster information
  top             Display resource (CPU/memory) usage
  cordon          Mark node as unschedulable
  uncordon        Mark node as schedulable
  drain           Drain node in preparation for maintenance
  taint           Update the taints on one or more nodes

Troubleshooting and Debugging Commands:
  describe        Show details of a specific resource or group of resources
  logs            Print the logs for a container in a pod
  attach          Attach to a running container
  exec            Execute a command in a container
  port-forward    Forward one or more local ports to a pod
  proxy           Run a proxy to the Kubernetes API server
  cp              Copy files and directories to and from containers
  auth            Inspect authorization
  debug           Create debugging sessions for troubleshooting workloads and nodes
  events          List events

Advanced Commands:
  diff            Diff the live version against a would-be applied version
  apply           Apply a configuration to a resource by file name or stdin
  patch           Update fields of a resource
  replace         Replace a resource by file name or stdin
  wait            Experimental: Wait for a specific condition on one or many resources
  kustomize       Build a kustomization target from a directory or URL

Settings Commands:
  label           Update the labels on a resource
  annotate        Update the annotations on a resource
  completion      Output shell completion code for the specified shell (bash, zsh, fish, or powershell)

Subcommands provided by plugins:

Other Commands:
  api-resources   Print the supported API resources on the server
  api-versions    Print the supported API versions on the server, in the form of "group/version"
  config          Modify kubeconfig files
  plugin          Provides utilities for interacting with plugins
  version         Print the client and server version information

Usage:
  kubectl [flags] [options]

Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).
root@DESKTOP-R12R5NH:/# uname -m
x86_64
root@DESKTOP-R12R5NH:/# curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 37.0M  100 37.0M    0     0  4006k      0  0:00:09  0:00:09 --:--:-- 5057k
root@DESKTOP-R12R5NH:/# sudo dpkg -i minikube_latest_amd64.deb
Selecting previously unselected package minikube.
(Reading database ... 42864 files and directories currently installed.)
Preparing to unpack minikube_latest_amd64.deb ...
Unpacking minikube (1.35.0-0) ...
Setting up minikube (1.35.0-0) ...
root@DESKTOP-R12R5NH:/# minikube start
😄  minikube v1.35.0 on Ubuntu 22.04 (amd64)
✨  Automatically selected the docker driver. Other choices: none, ssh
🛑  The "docker" driver should not be used with root privileges. If you wish to continue as root, use --force.
💡  If you are running minikube within a VM, consider using --driver=none:
📘    https://minikube.sigs.k8s.io/docs/reference/drivers/none/

❌  Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.

root@DESKTOP-R12R5NH:/# ^C
root@DESKTOP-R12R5NH:/# minikube start --driver=docker --force
😄  minikube v1.35.0 on Ubuntu 22.04 (amd64)
❗  minikube skips various validations when --force is supplied; this may lead to unexpected behavior
✨  Using the docker driver based on user configuration
🛑  The "docker" driver should not be used with root privileges. If you wish to continue as root, use --force.
💡  If you are running minikube within a VM, consider using --driver=none:
📘    https://minikube.sigs.k8s.io/docs/reference/drivers/none/
📌  Using Docker driver with root privileges
👍  Starting "minikube" primary control-plane node in "minikube" cluster
🚜  Pulling base image v0.0.46 ...
💾  Downloading Kubernetes v1.32.0 preload ...
    > preloaded-images-k8s-v18-v1...:  333.57 MiB / 333.57 MiB  100.00% 3.34 Mi
    > gcr.io/k8s-minikube/kicbase...:  500.31 MiB / 500.31 MiB  100.00% 2.77 Mi
🔥  Creating docker container (CPUs=2, Memory=2200MB) ...
🐳  Preparing Kubernetes v1.32.0 on Docker 27.4.1 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
root@DESKTOP-R12R5NH:/# kubectl get no
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   86s   v1.32.0
root@DESKTOP-R12R5NH:/# kubectl get no
NAME       STATUS   ROLES           AGE    VERSION
minikube   Ready    control-plane   112s   v1.32.0
root@DESKTOP-R12R5NH:/# kubectl get pods -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS       AGE
kube-system   coredns-668d6bf9bc-9gw5t           1/1     Running   0              92s
kube-system   etcd-minikube                      1/1     Running   0              119s
kube-system   kube-apiserver-minikube            1/1     Running   0              98s
kube-system   kube-controller-manager-minikube   1/1     Running   1 (116s ago)   115s
kube-system   kube-proxy-vgxq6                   1/1     Running   0              92s
kube-system   kube-scheduler-minikube            1/1     Running   0              2m3s
kube-system   storage-provisioner                1/1     Running   1 (42s ago)    84s
root@DESKTOP-R12R5NH:/# kubectl get ns
NAME              STATUS   AGE
default           Active   2m31s
kube-node-lease   Active   2m30s
kube-public       Active   2m32s
kube-system       Active   2m32s

root@DESKTOP-R12R5NH:/# history
    1  docker ps
    2  docker image
    3  docker images
    4  curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
    5  curl -LO https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl
    6  curl -LO https://dl.k8s.io/release/v1.32.0/bin/linux/arm64/kubectl
    7  curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
    8  sudo apt-get update
    9  sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
   10  curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
   11  sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
   12  echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
   13  sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list
   14  sudo apt-get update
   15  sudo apt-get install -y kubectl
   16  kubectl
   17  uname -m
   18  curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
   19  sudo dpkg -i minikube_latest_amd64.deb
   20  minikube start
   21  minikube start --driver=docker --force
   22  kubectl get no
   23  kubectl get pods -A
   24  kubectl get ns
   25  minikube start --driver=docker --force
   26  kubectl get ns
   27  history
root@DESKTOP-R12R5NH:/# minikube version
minikube version: v1.35.0
commit: dd5d320e41b5451cdf3c01891bc4e13d189586ed-dirty
root@DESKTOP-R12R5NH:/# minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

Conclusion

Congratulations! You have successfully installed and configured Minikube on Ubuntu WSL2. With Minikube, you can now experiment with Kubernetes locally, deploy applications, and explore various Kubernetes features.

For more information, check the official Minikube documentation.