How to install Minikube in Google Cloud Vm Instance

Siddharth Satpute
Google Cloud - Community
3 min readMar 30, 2023

Introduction

Minikube is a lightweight tool that enables you to run a single-node Kubernetes cluster on your local machine. This can be useful for developers who want to test their applications in a Kubernetes environment before deploying them to production. In this article, we will walk you through the steps to install Minikube on a Google Cloud VM instance.

Demo on Installing minikube on Google Cloud

Step 1 : Create a new GCP VM

Follow the instructions on the GCP documentation to create a new VM. Make sure to select an appropriate machine type and operating system.

Step 2: Install Docker as a part of vm automation script

sudo apt install docker.io
docker --version

Step 3: Run the bellow command which installs all the other dependencies to run minikube

sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2 curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && sudo chmod +x /usr/local/bin/kubectl
sudo apt-get update && sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager

Overall, these commands install the necessary dependencies for running Minikube on a Ubuntu-based system, including kubectl, and a hypervisor.

Step 4: Install the minikube using curl command

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Step 5: This command is used to start a Kubernetes cluster using Minikube with the Docker container runtime as the drive

minikube start --driver=docker

Step 6: This command is used to add the current user to the docker group and start a new shell with the updated group membership.

sudo usermod -aG docker $USER && newgrp docker

Step 7: rerun this command

minikube start --driver=docker

Step 8: This command is used to list all the pods in all namespaces of a Kubernetes cluster.

kubectl get po -A

Step 9: to check minikube status

minikube status

Step 10: This command is used to list all the nodes in a Kubernetes cluster.

kubectl get node

Final Verdict :

In conclusion, Minikube offers a convenient and easy-to-use solution for testing and developing Kubernetes applications locally. Its simple setup process, compatibility with various operating systems, and extensive documentation make it a popular choice for developers and organizations looking to experiment with Kubernetes without investing in expensive infrastructure. However, it may not be suitable for large-scale production deployments, and users may need to consider other Kubernetes solution

Drop your comments, feedback, or suggestions below — or connect with me directly on Linked @https://www.linkedin.com/in/siddharth-satpute/

Happy learning !!!

--

--