Docker & Kubernetes Part 2 with Minikube

Greetings earthlings! And non-earthlings. Last time we spoke about Docker and Kubernetes was very brief. Today we're going to dive into running Kubernetes as your orchestration tool.

Speaking of orchestration, what is this? Let's dig into why you need both Docker and K8 (short for Kubernetes). Docker, like LXC, is the container engine. This engine allows you to create your images that you will run as containers. These images consist of whatever you want, from a MySQL image to a Redis image to a Nginx image. Think of this as your "golden image" or your "template". This "golden image" or "template" allows you to spin up your environment however you'd like.

Now, for the K8 part. What does K8 do? It gives you the orchestration. It allows you to spin up your environment, as customized as you want, and with however many of those environments you want. For example, let's say you're running an application for your organization. This application goes out to clients and you are manually spinning up VM's, which you don't want to do anymore because it's a time sink and a lot of resources. You can use something like K8 to spin up an entire environment for a client in minutes. As a matter of fact, you can spin up TEN or TWENTY on ONE HUNDRED of that same exact environment.

Today we're going to be spinning up that Kubernetes environment on a Mac with Docker, Kubernetes, Kubernetes Manfiests, and minikube. Minikube is an interesting little tool. With Kubernetes, you're supposed to have multiple notes for redundancy and failover. That's one of the big points of orchestration. Instead of having to do all of that in a test environment, Minikube allows you to do this locally with one node. Let's get started.

The first thing we want to confirm is that Docker for Mac is installed and Kubernetes is running. To install this, we will use Brew. For install instructions to use brew, please follow this link: https://brew.sh/

First, you are going to install the Docker engine for Mac. For instructions on this, please look at part one of Docker & Kubernetes.

The first thing we want to do is confirm kubectl is installed. Kubectl is the Kubernetes API CLI we will use to manage Kubernetes

brew install kubernetes-cli

To confirm it was installed, check the version. You should see something similar to the lines below. Depending on when you read this, you may have a newer version.

kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:55:54Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}

To install minikube and give execute permissions to the owner, run the following:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23.0/minikube-darwin-amd64 && chmod +x 

The above will pull down Minikube. In the curl command, the -Lo is important. The "L" will pull from a new location if the specified URL moved. The "o" is to output the info from the download.

Once installed, you're going to run minikube and move the binary to the bin directory.

minikube && sudo mv minikube /usr/local/bin/

Next, run the following:

minikube start

This will start the installation of minikube on your local system and get your local/dev environment ready. You should see something like the below (please note: this may take a while):

To disable this notification, run the following:
minikube config set WantUpdateNotification false
Starting local Kubernetes v1.8.0 cluster...
Starting VM...
Downloading Minikube ISO
 140.01 MB / 140.01 MB [============================================] 100.00% 0s

If everything was set up properly, you should see the following:

Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.

If not, please take a look at these troubleshooting steps:

If any VM issues with Fusion of VirtualBox, run the following:

Run minikube start --vm-driver=none instead

if you have any permission denied errors, give yourself read/execute/write permissions on the minikube binary run the following:

chmod 700 /usr/bin/minikube

That's the gist! In part 3, we will start spinning up pods and deployments with docker images we bring down from Docker Hub.

Docker & Kubernetes Part 2 with Minikube
Share this