How to Get Started with Kubernetes and Minikube Basics

peterj

Peter Jausovec

Posted on August 28, 2019

How to Get Started with Kubernetes and Minikube Basics

Minikube is an awesome tool that allows you to run a single-node Kubernetes cluster inside a virtual machine, on your own computer.

To help you get started, I have recorded a video to guide you through the Minikube installation process. In the video, I explain and introduce a couple of essential Minikube commands you can use to work with the Kubernetes cluster and show you how to access applications inside the cluster when using Minikube.

This is my first attempt at making a video, and I would love to hear your feedback!

Managing Your Minikube Cluster

Creating a new cluster is as simple as running minikube start. By default, the start command creates a virtual machine with 2 CPUs and 2000 MB of memory. Often, that might not be enough, so you can use --cpus and --memory flags to set the desired amount of CPUs and memory like this:

minikube start --cpus=4 --memory 8192.
Enter fullscreen mode Exit fullscreen mode

To stop a virtual machine running your cluster, use the minikube stop command. This will stop the virtual machine, but it leaves all the files around, so you can use the start command to start up the cluster again. I usually stop my cluster if I am not using it, so it's not eating up all the CPUs and memory.

Troubleshooting Minikube Issues

Hopefully, you won't run into any issues with Minikube, however, in case you do, use the minikube status command to quickly get the status of your cluster. If you need to dig deeper and get more information on what's happening, use the minikube logs command. The logs command will output all logs from the running Kubernetes instance.

Interacting With Your Kubernetes Cluster

In most cases, you will use the Kubernetes CLI (kubectl) to interact with your cluster. However, if you're more visual, you can also use the Kubernetes dashboard. Minikube automatically installs Kubernetes dashboards and it has a convenience command called minikube dashboard that creates a proxy to the dashboard and opens the dashboard UI in the browser.

To access your cluster and services running within the cluster you will use the clusters IP. To get the clusters IP address, run minikube ip command. This command outputs the clusters IP to the standard out. You can use the combination of the IP address and your service ports to access the services.

Minikube also offers two commands that allow you to quickly access the services. One command is called minikube service. If your service is of a NodePort type, you can use this command to quickly access the service. Minikube will use the clusters IP and the port and open your service in the browser.

Alternatively, if you have services using the LoadBalancer type, you can use the minikube tunnel command. This command exposes all services with LoadBalancer type on the http://localhost address.

💖 💪 🙅 🚩
peterj
Peter Jausovec

Posted on August 28, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related