Create a Kubernetes cluster using minikube on ubuntu in 10 minutes !!
Overview:
- Install hypervisor (Virtualbox)
- Get and install Kubectl (repositories)
- Get and install Minikube last version
- Start and Test Minikube local cluster and expose demo service
Install VirtualBox hypervisor
We will install virtualbox 5.* via official reposiories
$ sudo apt-get update
$ sudo apt remove virtualbox*
$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
$ sudo su
$ echo "deb https://download.virtualbox.org/virtualbox/debian xenial contrib" >> /etc/apt/sources.list
$ apt-get update
$ sudo apt-get install virtualbox virtualbox-ext-pack
Install kubectl on Linux
Install kubectl binary with curl on Linux
- Download the latest release with the command:
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/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 Linux, type:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
2. Make the kubectl binary executable.
chmod +x ./kubectl
3. Move the binary in to your PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
4. check the kubectl version to check if it’s properly installed.
kubectl version --client
Install Minikube
Download minikube binary directly from Google repositories.
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
$ sudo mv -v minikube /usr/local/bin
$ minikube version
$ exit
Start Kubernetes Cluster locally with Minikube
Create and run Kubernetes cluster. This will take some few minutes depending on your Internet connection.
$ minikube start
Test Kubernetes service
We test our cluster running a demo service
$ kubectl cluster-info
$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
$ kubectl get services
$ minikube dashboard
minikube dashboard will open in your default web browser.
You’ve successfully run your first kubernetes cluster using minikube. In my next article , i will show how to setup a production level kubernetes cluster to deploy Hyperledger fabric network using NFS servers.
If you guys liked my article, don’t forget to clap. It will motivate me to make more articles and contribute more to the community. You can also follow me to stay updated with my latest articles.