Search Tutorials


Spring Boot + Kubernetes Tutorial - Installing Kubectl, Minikube and Docker on Ubuntu | JavaInUse



Spring Boot + Kubernetes Tutorial - Installing Kubectl, Minikube and Docker on Ubuntu

In a previous tutorial, we looked at the kubernetes architecture. For this tutorial we will be making use of Minikube. Minikube creates a simple local kubernetes cluster having one Virtual Machine. Also we will be installing kubectl which is a kubernetes command line tool to give commands to manage the kubernetes cluster.

Video

This tutorial is explained in the below Youtube Video.

Spring Boot + Kubernetes Tutorial

What is Kubernetes? Need for it? Install Ubuntu on Windows using WSL Installing Kubectl, Minikube and Docker on Ubuntu Create Docker Image Deploy to Minikube Pods Difference between ClusterIP, NodePort and LoadBalancer Service Service Hello World Example

Implementation

Install Minikube

Previously we installed Ubuntu on Windows using WSL. We will be using this Ubuntu terminal for creating the minikube kubernetes cluster.
Minikube Kubernetes cluster
We will first download the minikube installable as follows -
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Minikube Kubernetes download
Then install the downloaded minikube installable -
chmod +x minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
which minikube

Minikube Kubernetes install
Let us now start minikube
minikube start

Minikube Kubernetes start no driver
We get an exception. Minikube needs a hypervisor such as VirtualBox or Docker to create this VM. To provide minikube the required hyperv driver we will be installing docker.
sudo snap install docker
docker --version

install docker using snap
If we now start minikube again it starts properly
minikube start --force

Minikube Kubernetes start with docker

Install Kubectl

Next using a client side tool we will connect to kubernetes cluster to read, create, modify well known kubernetes resources (like pod, deployment, services). This client side tool is kubectl.
Minikube Kubernetes cluster client kubectl
Download kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

install docker using snap
Copy the kubectl exectuble to the bin folder.
chmod +x kubectl
cp kubectl /usr/local/bin/
which kubectl

install docker using snap