Install MiniKube in windows with Docker Driver

Tariqul Islam
4 min readOct 26, 2021

Install Docker Desktop on Windows

  1. Download Docker Desktop Installer.exe from docker hub Docker Hub.
  2. Double-click Docker Desktop Installer.exe to run the installer.
  3. When the installation is successful, click Close to complete the installation process.

Check the WSL2 feature installation

4. Then Create Docker Account if you have no docker account yet.

Start Docker Desktop

Docker Desktop does not start automatically after installation. To start Docker Desktop:

  1. Search for Docker in the search bar, and select Docker Desktop in the search results.

If the docker is running perfectly, you will see the following display in the window after clicking on settings->Generalbutton into docker desktop application

Install chocolatey package manager into windows to install Kubectl

> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1'))

Install kubectl by chocolatey package manage by following command PowerShell

> choco install kubernetes-cli

Test to ensure the version you installed is up-to-date:

> kubectl version --client

Create the .kube directory where all the configurations are saved into

> cd C:\Users\<loggedin_user_folder>\
> mkdir .kube

Go to the .kube directory you just created by the following command:

> cd .kube

Create the configuration file in the .kube folder by PowerShell Command:

> New-Item config -type file

Prerequisite for MiniKube installation in windows

  • 2 CPUs or more
  • 2GB of free memory
  • 20GB of free disk space
  • Internet connection
  • Docker

Use wingetpackage manager to install minikube into window 10 by the following command

> winget install minikube

Then start the minikube in window 10 by following the command below

> minikube start

This command creates the minikube image container into docker and configures the Kubernetes into the config file. You can open the file in which is created into in .kube folder to see the configuration.

Access the minikube dashboard by following the command below

> minikube dashboard

Deploy the sample site into minikube

Create the folder into your windows PC with PowerShell

> cd <desired_drive_letter>:
> mkdir flask_app_deployment

Create the Kubernetes deployment file with PowerShell

> New-Item deployment.yaml -ItemType File

Then past the following code below into deployment.yaml file for Kubernetes deployment

This file contains Kubernetes service and deployment Kind

Service

  1. in line 2 declare the Kubernetes element or kind as a service
  2. line 4 give the service name as flask-test-service
  3. line 9, 10, 11 provide the protocol and port number that how the service interacts with other services and the Kubernetes environment
  4. line 12, type of pod and I add the service as “LoadBalancer”

Deployment

  1. line 18 provide the name of the deployment as flask-test-app
  2. line 23, declare how many replicas are loading into the Kubernetes environment for flask-test-service
  3. 29, 30, 31, 32 application docker image source and declare pull policy where to get the docker image. I build the example docker image into DokerHub for using Minikube deployment test, adding the following link docker.io/tariqulislam/minikube-flask-app into line 31
  4. line 33 to 36 how much resources are used to deploy the pod or service into Kubernetes
  5. deployment port mapping with service. should be the same as the target port of the service.

Then run the following command to deploy the application into Minikube by kubectl

> kubectl apply -f deployment.yaml

Then check pod is running for Kubernetes deployment service

> kubectl get po

Then run the following command to get the service access information and for the website get the URL by the following command.

> minikube service flask-test-service

The minikube command will automatically open into the browser by the previous minikube command

Check the Kubernetes deployment, pods, and services, replicas into the MiniKube dashboard following the command

> minikube dashboard

--

--

Tariqul Islam

Tariqul Islam have 9+ years of software development experience. He knows Python, Node Js and Java, C# , PHP.