Getting started with Kubernetes (Part -1 ): Setting up k8s cluster with Minikube
I will assume you already know about Kubernetes, you have some knowledge with Docker and you want to utilize your Docker knowledge to get started with Kubernetes. It’s kind of hard to get to see the big picture with Kubernetes, but once you there it will be worth it. This post is not going to make you a pro, but at least you will be getting started with Kubernetes on your local machine. Sit tight and let’s get started.
Things you will need before getting started with Hands-on:
- A Working Kubernetes Cluster ( We are going to use Minikube )
- Kubectl (Command line tool for controlling Kubernetes clusters)
- Virtualbox
- Docker
Install Kubectl on Ubuntu
Run the following command to install kubectl to your Ubuntu.
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://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
If you are on Linux and using Homebrew package manager, kubectl is available for installation.
brew install kubectl
kubectl version --client
Install kubectl binary with curl on macOS
- Download the latest release:
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl"
- To download a specific version, replace the
$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
portion of the command with the specific version. - For example, to download version v1.18.0 on macOS, type:
Make the kubectl binary executable.
chmod +x ./kubectl
Move the binary in to your PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
Test to ensure the version you installed is up-to-date:
kubectl version --client
Install with Homebrew on macOS
If you are on macOS and using Homebrew package manager, you can install kubectl with Homebrew. Run the installation command:
brew install kubectl
brew install kubernetes-cli
Test to ensure the version you installed is up-to-date:
kubectl version --client
Install kubectl binary with curl on Windows
- Download the latest release v1.18.0 from this link.
- Or if you have
curl
installed, use this command:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe
To find out the latest stable version (for example, for scripting), take a look at https://storage.googleapis.com/kubernetes-release/release/stable.txt.
Add the binary to your PATH. Test to ensure the version of kubectl
is the same as downloaded:
kubectl version --client
Install Minikube
Before installing Minikube, you need to make sure if virtualization is supported by your system. Run the following command and make sure that the output is non-empty:
Linux
grep -E --color 'vmx|svm' /proc/cpuinfo
Windows
systeminfo
Mac
sysctl -a | grep -E --color 'machdep.cpu.features|VMX'
If you see VMX
in the output (should be colored), the VT-x feature is enabled in your machine.
Install Virtual Box
Download and install Virtualbox from here.
https://www.virtualbox.org/wiki/Downloads
Install Docker
You can install Docker for Mac, Windows, or Linux from here:
https://docs.docker.com/get-docker/
Install Minikube and setup k8s cluster
For Linux users, we provide 3 easy download options:
Binary download
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Debian package
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
RPM package
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
sudo rpm -ivh minikube-latest.x86_64.rpm
If the Brew Package Manager installed:
brew install minikube
If which minikube
fails after installation via brew, you may have to remove the minikube cask and link the binary:
brew cask remove minikube
brew link minikube
Otherwise, download minikube directly:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube
If the Chocolatey Package Manager is installed, use it to install minikube:
choco install minikube
Otherwise, download and run the Windows installer.
Let’s get our hands dirty with minikube . In the second part, I have written how to start using Minikube , you can find it here.