Kunal Kushwaha avatar
By Kunal Kushwaha
DevRel Manager


This lesson is designed to help you become familiar with Minikube, a tool that simplifies the process of setting up a Kubernetes cluster on your local machine. By the end of this lesson, you'll have a solid understanding of various Minikube commands and how to use them to perform tasks efficiently.

Getting started with Minikube commands

One of the most useful commands in Minikube is docker-env. This command outputs the environment variables required for a local Docker client to communicate with a remote Docker server. In this case, the Docker server is inside a virtual machine created by Minikube. If you've worked with Docker machines before, you'll find the output of minikube docker-env similar to docker-machine env.

Verifying your Minikube setup

Verification is an essential part of working with Minikube. You can list all the running containers on the virtual machine using the command `docker container ls`. This command will show you all the containers that Kubernetes requires, giving you a glimpse into the system containers.

Accessing the Virtual Machine with SSH

While most of your interactions with the virtual machine will be through the local Docker client and Kubectl, there may be times when you need to SSH into the virtual machine. You can do this using the minikube ssh command. Once inside, you can list all the containers using docker container ls.

Configuring Kubectl with Minikube

To ensure Kubectl is pointing to the correct virtual machine, use the command kubectl config current-context. If everything is set up correctly, this command will return Minikube. You can also list all the nodes in your cluster using `kubectl get nodes`. Since Minikube creates a single-node cluster, this command should return Minikube.

Exploring your cluster

To get a comprehensive view of your cluster, use the command `kubectl get all-namespaces`. This command will show you all the applications, dashboards, and other resources running in your cluster.

Starting, stopping, and deleting a cluster

Minikube provides commands to start, stop, and delete your Kubernetes cluster. The minikube stop command shuts down the virtual machine but preserves all the cluster states and data. You can start the cluster again with minikube start, which restores it to its previous state. If you want to delete the cluster, use minikube delete. This command shuts down and deletes the Minikube virtual machine, but it does not preserve any data or state.

Don't stop now, check out your next lesson