Guide to install Minikube on windows to practice Kubernetes and create your first pod.

Guide to install Minikube on windows to practice Kubernetes and create your first pod.

Publish Date: May 12
0 0

As a DevOps engineer we are using Kubernetes daily so for practicing it on your local machine we can set up the Minikube which help to practice the Kubernetes concepts.

Prerequisites for installing Minikube on Windows.

  • 2 CPUs or more
  • 2GB of free memory
  • 20GB of free disk space
  • Internet connection
  • Container or virtual machine manager, such as: Docker Desktop I will suggest.

Search for the Windows PowerShell on Windows right click on it and run it as an administrator

Image description

Now run the below Commands one by one

Step 1: Use the below command to download and run the installer for the latest release.

New-Item -Path 'c:\' -Name 'minikube' -ItemType Directory -Force
Invoke-WebRequest -OutFile 'c:\minikube\minikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing

Enter fullscreen mode Exit fullscreen mode

Step 2: Add the minikube.exe binary to your PATH

$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine)
if ($oldPath.Split(';') -inotcontains 'C:\minikube'){
  [Environment]::SetEnvironmentVariable('Path', $('{0};C:\minikube' -f $oldPath), [EnvironmentVariableTarget]::Machine)
}

Enter fullscreen mode Exit fullscreen mode

Step 3: Start your cluster

minikube start

Enter fullscreen mode Exit fullscreen mode

Step 4: See the status of the minikube if it is installed or not

minikube status
Enter fullscreen mode Exit fullscreen mode

Image description

If you are able to see the above details after running 4th command then Congratulations you have done the Minikube set up !!!

Run your first pod on Kubernetes with the help of minikube.

Step 1: Open the GitBash and change the directory to Download.

cd /c/Users/<your name>/Downloads
Enter fullscreen mode Exit fullscreen mode

Step 2: Create the pod.yaml file and paste the below data into it.
the following is an example of a Pod which consists of a container running the image nginx:1.14.2.

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80

Enter fullscreen mode Exit fullscreen mode

Step 3: Run the below command to create the pod with the help of the pod.yaml file

kubectl create -f pod.yaml
Enter fullscreen mode Exit fullscreen mode

It will shows like below image it means pod has been created.

Image description

Step 4: Run the below command to see which pods are running in the Kubernetes.

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

It will show like this

Image description

Step 5: You can use the below commands according to your requirement.

a. Get the all details of the pods

kubectl describe pod nginx
Enter fullscreen mode Exit fullscreen mode

b. Show Output in Wide Format (More Details like IP, Node)

kubectl get pods -o wide
Enter fullscreen mode Exit fullscreen mode

c. Get Logs of a Pod (For Debugging)

kubectl logs <pod-name>
Enter fullscreen mode Exit fullscreen mode

d. Check Pod's YAML Definition (Actual Configuration)

kubectl get pod <pod-name> -o yaml
Enter fullscreen mode Exit fullscreen mode

e. Open Minikube Dashboard (GUI View):It will open the dashboard in the web browser.

minikube dashboard

Enter fullscreen mode Exit fullscreen mode

That's all for the day Happy Learning !

Comments 0 total

    Add comment