Getting Started with Kubernetes and Minikube

If you want to get started with Kubernetes and take some time exploring the concepts and features of what this orchestration tool can bring to your infrastructure, but don’t have an access to Cloud provider like Google Cloud Platform, AWS or Microsoft Azure, Minikube will be the fastest and easiest option for you.

Kubernetes is a cluster consisting of masters and workers nodes, and deploying it can take a lot of time and resource. Having a full fledge Kubernetes cluster only for testing purpose would be meaningless anyway. And that’s why Minikube can be very handy.

What is Minikube?

Minikube is an all-in-one solution that comes in VM and providing all the features that a complete Kubernetes cluster may provide. In fact, in Kubernetes, you can have a node that has both the master and worker roles, and this is what Minikube is all about.

After installing Minikube, you will a one node Kubernetes cluster, and this node is a master and a worker at the same time.

What is Needed for Installing Minikube?

  • VT-x or AMD-v virtualization must be enabled in your computer’s BIOS.
  • A hypervisor must installed on your machine. This is because Minikube runs the Kubernetes cluster on a VM. VMware workstation, Microsoft Hyper-V, Oracle VirtualBox or KVM will do it.
  • A tool that is used to interact with your Kubernetes cluster called kubectl. By interacting, I mean creating resources like pods, deployments, services, …etc. kubectl is a command line interface for running commands against Kubernetes clusters. Kubernetes resources can also be created and managerd through the GUI Web console dashboard, but this tool stands far behind kubectl in terms of capabilities and management options.
  • An Internet connection for downloading the required binaries prior installation.

I am using a Windows 7 for my daily tasks, and using VMware Workstation 11 as a hosted hypervisor. I have one VM running CentOS 7 and I’ll take advantage of nested virtualization to install KVM, kubectl then Minikue as a nested VM on top of my virtualized CentOS server.

As such, the CPU virtualization is enabled on the VM settings. The VM has 4GB of vRAM, vCPU and 20GB of disk space.

Enable CPU virtualization for the CentOS VM


In fact, I could also have installed Minikube on my Windows 7 machine using Chocolatery, or Windows 10 using Hyper-V, but Linux is my something of choice when it comes to testing Open Source projects like Kubernetes or Docker.

A Side Note about Minikube Drivers

Several hypervisors can be used to run the Minikube VM, and in the Minikube jargon, these are called drivers. For instance, if you opt to use Hyper-V to run Minikube, you are using the hyperv driver. If instead, you want to use Oracle VirtualBox, the virtualbox driver needs to installed.

The installation steps will change depending on the driver you are using. More information can be found on the Kubernetes Official Documentation here.

This post will go through the installation of the kvm2 driver, Kubectl then Minikube on Linux CentOS 7. If you want to use Minikube on Windows. check this post instead.

Installing Minikube on Linux CentOS 7

Installing the kvm2 driver

To install the KVM2 driver, first install and configure the prereqs:

  • First, update your system
  • Install libvirt and qemu-kvm on your system
  • Start and enable libvirtd service


  • Add yourself to the libvirt group so you don’t need to sudo
  • Update your current session for the group change to take effect
  • If you are running a minimal CentOS installation, you will need install the x-window package to allow virt-manager to start. virt-manger can be used to manage the minikube VM from GUI.
  • Install the Minikube kvm2 driver

This kvm2 driver will be downloaded and saved to a directory called docker-machine-driver-kvm2

  • Make the kvm2 driver directory executable
  • Copy the kvm2 driver directory to your path
  • Once copied, you might want to delete it from your home directory to free up some space, as it is no longer needed


Installing Kubectl

On Linux, Kubectl can be compiled from source or installed from the released binaries, which is a faster and easier method to get this utility running in your machine. We’ll opt for this one.

  • Download kubectl binaries
  • Make the kubectl binaries directory executable
  • Add the kubectl executable to your path
  • Check your installation

No worries If you see a message similar to the following, stating that the connection was refused. kubectl is checking if it has been correctly configured to connect to an existing Kubernetes cluster. Because Minikue is not installed yet, the errors above shows up. As long as you can see the Client version displayed, that means that kubectl installation went fine.

Installing Minikube

  • Download Minikube Binaries
  • Install Minikube
  • Check Minikube Installation
  • To avoid any configuration issue, temporary disable SELiux

Now that Minikube and KVM are installed, you just need to start the Minikube VM using the KVM2 driver.

During these steps, the Minikube ISO, kubeadm and kubelet are downloaded then started, an IP address is assigned to the Minikube VM, certifications have been generated and assign to the cluster, and kubectl has been configured automatically to connect to 111411

Minikube also supports a –vm-driver=none option that runs the Kubernetes components on the host and not in a VM. This option will allow to run Kubernetes without the need to have a hypervisor installed for running the VM. Note that Docker is required to use this driver though. If you use –vm-driver=none, be sure to specify a bridge network for docker. Otherwise it might change between network restarts, causing loss of connectivity to your cluster.

The output of the command is shown below for demonstration purpose

Minikube is now installed and started. Check again the kubectl installation to confirm that it is able to see and connect to Minikube

You can also check the Minikube VM status by running the minikube status command. This will also display the IP that was assigned to the VM.

You can also install virt-manager, which is the graphical tool to manage KVM virtual machines, to check that the Minikube VM is effectively up and running.

Minikue VM up and running

If you’re not sure or forgot the IP address of the Minikube VM, you can display again with this command

To ssh to the Minikube VM, use the minikube ssh command


Working with Kubernetes

Run the Kubernetes dashborad

Kubernetes is usually managed with kubectl, but you can also the Web console dashboard. Fortunately, this will also be installed automatically during Minikube installation.

To display the Kubernetes Web console, use below command

The Kubernetes Dashboard

Running Kubernetes resources using Kubectl

Kubectl is the tool to use if you want to seriously get into Kubernetes and have all the advantages that it brings to the table, and once you get used of this tool, you won’t trade for it for the world.

To create a deployment, the kubectl run is used, so let’s get some on how to this

As you can see, the kubectl help is simply, very helpfull when it comes to clear and concise examples. Here, to run an nginx image to our freshly created Kubernetes lab cluster, run the following command:

To check that your deployment is running, use below command

Keep in mind, that there is another method to create Kubernetes resources, which by creating manifest files then running them with kubectl. And this the way to go in most of production environments, as this method provides more capabilities and flexibility, but I won’t go through the steps on how to do it in this post. The scope being just to install and run Minikube.

That’s it for this post. You have now a running cluster where you can test and manage your Kubernetes resources. Enjoy!


Find this post interesting. Share it!

Leave a Comment

Your email address will not be published. Required fields are marked *