Skip to main content

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:
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 && 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.


Popular posts from this blog

Run PowerShell code with Ansible on a Windows Host

Ansible is one of the Configuration Manager kings in the game. With it's easy-to-understand syntax and even easier to use modules, Ansible is certainly a go-to when you're picking what Configuration Management you want to use for your organization. Your question may be "but Ansible is typically on Linux and what happens when I'm in a Windows environment?". Luckily I'm here to tell you that Ansible will still work! I was pleasantly surprised with how easy it is to use Ansible on Windows with a little WinRM magic. Let's get started.

Pre-requisites for this post:
1) WinRM set up to connect to your Windows host from Ansible
2) Ansible set up for Windows Remote Management
3) SSH access to the Ansible host
4) Proper firewall rules to allow WinRM (port 5985) access from your Ansible host to your Windows host
5) Hosts file set up in Ansible that has your IP or hostname of your Windows Server.
6) At least one Linux host running Ansible and one Windows Server host …

Running PowerShell commands in a Dockerfile

As Docker continues to grow we are starting to see the containerization engine more and more on Windows. With the need for containers on Windows, we also need the same automation we get in Linux with Dockerfiles. Today we're going to create a Dockerfile that runs PowerShell cmdlets.
Prerequisites; 1. Docker for Windows
2. A code editor (VSCode preferred)

Let's go ahead and get our Dockerfile set up. Below is the Dockerfile I used for this post.

from MAINTAINER Michael Levan RUN powershell -Command Install-WindowsFeature -Name Web-Server RUN powershell -Command New-Item -Type File -Path C:\ -Name config
As you can see from the above, this is a tiny Dockerfile. What this will do is install the IIS Windows 

Feature and create a new file in C:\ called "config".
You should see something very similar to the below screenshot;

Next let's create a running container out of our image. First we'll need to run docker container ls to

 get o…

DevOps tooling in the Microsoft realm

When I really started to dive into automation and practicing DevOps with specific tooling, there were a few key players. At the time Microsoft was not one of them. They were just starting to embrace the open source world, including the art and practice of DevOps. Since then Microsoft has went all in and the tech giant has made some incredible tooling. Recently I switched to a Microsoft-heavy environment and I love it. I went from AWS/Python/Ansible/Jenkins to Azure/PowerShell/ARM/Azure DevOps. My first programming language was PowerShell so being back in the saddle allowed me to do a full circle between all of the different types of tooling in both worlds. Today I want to share some of that tooling with you.

The first thing I want to talk about is ARM. What is ARM? ARM is a configuration management tool that allows you to perform software-defined-infrastructure. Much like Ansible and Terraform, ARM allows you to define what you want your environment to look like at scale. With ARM, yo…