<< All Posts
Kubernetes - Installing Minikube and Kubectl on Ubuntu Linux


I don’t believe I need to tell you this but I’m gonna mention anyways. DO NOT RUN Minikube in Production! This is just for your local environment so you can play with Kubernetes, set up your own cluster, set up metrics and nodes. Minikube will help you to start your master node and from that one, you’ll be able to create loadbalancers, auto-scale your application and learn Kubernetes easily without using your credit-card on some fancy kubernetes services from Azure, AWS or GCP.

First, let’s check if you have a CPU with support to virtualization. If the output of this is non-empty, we’re good to go:

grep -E --color 'vmx|svm' /proc/cpuinfo


1. Installing kubectl

https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-linux

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 -
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

kubectl version

2. Installing Minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube

sudo mkdir -p /usr/local/bin/
sudo mv minikube /usr/local/bin/

3. Setting things up

minikube start

Output:

😄  minikube v1.5.2 on Ubuntu 18.04
✨  Automatically selected the 'virtualbox' driver (alternates: [none])
💿  Downloading VM boot image ...
    > minikube-v1.5.1.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.5.1.iso: 143.76 MiB / 143.76 MiB [-] 100.00% 4.73 MiB p/s 31s
🔥  Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.16.2 on Docker '18.09.9' ...
💾  Downloading kubelet v1.16.2
💾  Downloading kubeadm v1.16.2
🚜  Pulling images ...
🚀  Launching Kubernetes ...
⌛  Waiting for: apiserver
🏄  Done! kubectl is now configured to use "minikube"

If you want to clear minikube’s local state: minikube delete

4. Final test

Our final goal is make sure your local kubernetes cluster via Minikube is talking properly with your kubectl which is the command line tool you’re gonna need for everything kubernetes (k8s) related.

We’re expecting to see “minikube” as output for this command:

kubectl config current-context

minikube

kubectl get nodes

NAME       STATUS   ROLES    AGE     VERSION
minikube   Ready    master   2m53s   v1.16.2

Great, now our master node is up and running, next step will be start adding some "pods" based on a custom Docker image and make sure we learn how to scale things to 1, 2 or why not 100 nodes? 😄



<< All Posts