Getting started with Minikube: Kubernetes on your laptop

A step-by-step guide for running Minikube.
332 readers like this.
cubes coming together to create a larger cube

Opensource.com

Minikube is advertised on the Hello Minikube tutorial page as a simple way to run Kubernetes for Docker. While that documentation is very informative, it is primarily written for MacOS. You can dig deeper for instructions for Windows or a Linux distribution, but they are not very clear. And much of the documentation—like one on installing drivers for Minikube—is targeted at Debian/Ubuntu users.

This guide aims to make things easier for RHEL/Fedora/CentOS-based operating system users.

Prerequisites

  1. You have installed Docker.
  2. Your computer is an RHEL/CentOS/Fedora-based workstation.
  3. You have installed a working KVM2 hypervisor.
  4. You have a working docker-machine-driver-kvm2. The following commands will install the driver:
    curl -Lo docker-machine-driver-kvm2 https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 \
    chmod +x docker-machine-driver-kvm2 \
    && sudo cp docker-machine-driver-kvm2 /usr/local/bin/ \
    && rm docker-machine-driver-kvm2

Download, install, and start Minikube

  1. Create a directory for the two files you will download: minikube and kubectl.
  1. Open a terminal window and run the following command to install minikube.
    curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

    Note that the minikube version (e.g., minikube-linux-amd64) may differ based on your computer's specs.

  1. chmod to make it executable.
    chmod +x minikube
  1. Move the file to the /usr/local/bin path so you can run it as a command.
    mv minikube /usr/local/bin
  1. Install kubectl using the following command (similar to the minikube installation process).
    curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

    Use the curl command to determine the latest version of Kubernetes.

  1. chmod to make kubectl executable.
    chmod +x kubectl
  1. Move kubectl to the /usr/local/bin path to run it as a command.
    mv kubectl /usr/local/bin
  1. Run minikube start. To do so, you need to have a hypervisor available. I used KVM2, and you can also use Virtualbox. Make sure to run the following command as a user instead of root so the configuration will be stored for the user instead of root.
    minikube start --vm-driver=kvm2

    It can take quite a while, so wait for it.

  1. Minikube should download and start. Use the following command to make sure it was successful.
    cat ~/.kube/config
  1. Execute the following command to run Minikube as the context. The context is what determines which cluster kubectl is interacting with. You can see all your available contexts in the ~/.kube/config file.
    kubectl config use-context minikube
  1. Run the config file command again to check that context Minikube is there.
    cat ~/.kube/config
  1. Finally, run the following command to open a browser with the Kubernetes dashboard.
    minikube dashboard

Kubernetes dashboard

Now that Minikube is up and running, read Running Kubernetes Locally via Minikube to start using it.

Tags
User profile image.
Bryant Jimin Son is an Octocat, which not official title but likes to be called that way, at GitHub, a company widely known for hosting most open source projects in the world. At work, he is exploring different git technology, GitHub Actions, GitHub security, etc. Previously, he was a Senior Consultant at Red Hat, a technology company known for its Linux server and opensource contributions.

1 Comment

Great article.
Just a small comment: I think that `chmod +x` makes a file executable not writable.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.