How to install kubernetes

Posted on Sunday July 08, 2018 by Eric Potvin

Before we start, please make sure you read the kubernetes-101 first.
This article will not cover installation on Windows system.

Verify virtualization

Before you start, make sure that VT-x/AMD-v virtualization is enabled. Minikube requires it! A simple check can help you figure out if virtualization is already enabled.

Linux

cat /proc/cpuinfo | egrep 'vmx|svm' | wc -l

OS X

sysctl -a | grep machdep.cpu.features | grep VMX | wc -l

If the output number is greater than zero, you all set!

Install a Hypervisor

A hypervisor is a program that would enable you to host virtual machines on a single hardware.

Linux

VirtualBox or kvm

OS X

VirtualBox or hyperkit

Installing kubectl

Linux (Debian)

sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo touch /etc/apt/sources.list.d/kubernetes.list
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

Linux (RHEL)

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubectl

OS X

brew install kubernetes-cli

If links are broken, please see the official procedure at https://kubernetes.io/docs/tasks/tools/install-kubectl/

Install minikube

First let's find out the newest version.

curl -q "https://github.com/kubernetes/minikube/releases/latest"

This will output something like:

<html><body>You are being <a href="https://github.com/kubernetes/minikube/releases/tag/v0.28.0">redirected</a>.</body></html>

The latest (as of July 8th, 2018) version is v0.28.0.

Linux

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.28.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
#                                                                     ^--- make sure to change this if needed

OS X

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.28.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
#                                                                     ^--- make sure to change this if needed

Installation done! Now let's get started with kubernetes.