Getting started with Minikube: Kubernetes on your laptop

Getting started with Minikube: Kubernetes on your laptop

A step-by-step guide for running Minikube.

cubes coming together to create a larger cube
Image by : 

opensource.com

x

Get the newsletter

Join the 85,000 open source advocates who receive our giveaway alerts and article roundups.

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

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

Topics

About the author

Bryant Son - Bryant Jimin Son is a Consultant at Red Hat, a technology company known for its Linux server and opensource contributions. At work, he is working on building the technology for clients leveraging the Red Hat technology stacks like Openshift, Ansible, and full stack development using Java, Spring Framework, AngularJS, Material design. Prior to joining Red Hat, Bryant was at Citi Group's Citi Cloud team, building the private Infrastructure as a Service (IaaS) cloud platform servering 8,000+ teams...