Install Kubernetes with Minikube
This article on Install Kubernetes with Minikube will walk you through the steps which is required to install and setup kubernetes and minikube on your development box.
Kubernetes is an open-source platform which helps in managing containers which is used to deploy the applications, with kubernetes you can scale and automate the deployment process.
Minikube– Well it can be said mini kubernetes because it runs on development machine not in production.
Why we need minikube if it is not used in production?
To answer this question – developer’s development box are pretty much standard one with limited memory and hardware configuration, so to run production grade application on developer machine it will be an expensive operation.
To handle this kind of situation we have minikube which can be used to develop and test actual production application on developers machine.
For Kubernetes installation on Ubuntu, please refer to my 14 steps guide - 14 Steps to Install kubernetes on Ubuntu 18.04 and 16.04 (“hashicorp/bionic64”)
For Kubernetes installation on CentOS, please refer to my 15 steps guide - 15 Steps: Install Kubernetes on CentOS “bento/centos-7
What you will need?
In this article I will be using OS Linux Mint 19.1 “Tessa” – Cinnamon (64-bit) but the steps are pretty much same for the other version of Linux Distributions for example - Ubuntu, CentOS, Fedora etc.
Before we jump into the actual steps, lets see what are the steps and software packages we wil be needing during the installation –
- Oracle VM VirtualBox – VirtualBox 6.1.32
- kubectl – Kubernets v1.23.0
- minikube – Minikube v1.25.1
- Operating System – Linux Mint 19.1 “Tessa” – Cinnamon (64-bit)
Oracle VM VirtualBox : Download and Install
First thing first you need to install the VirtualBOx on your development box. Oracle VM VirtualBOx can be downloaded from here
At the time of writing this article I have installed – VirtualBox 6.0.8
If you like terminal a lot then you could use following command to get it installed on your devbox
1$ sudo apt-get update
2$ sudo apt-get install virtualbox
Check the installation of virtual box
1$ virtual
The above command should laund the virtual box on your devbox.
kubectl : Download and Install
Now after installing the Oracle VM VirtualBox next step would be to install “kubectl” sdk on your development box. You can refer the installation instruction provided from official kubernetes website
1. Download the latest kubectl release using following command
1curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Validate the checksum agains the binary
1echo "$(<kubectl.sha256) kubectl" | sha256sum --check
2. Verify the checksum
1curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
3. After downlaoding the binaries we need to make it executable using following command
1$ chmod +x ./kubectl
4. Install the Kubectl binary
1$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
(Note – If you do not have sudo access the use the following command to install the minikube)
1chmod +x kubectl
2mkdir -p ~/.local/bin/kubectl
3mv ./kubectl ~/.local/bin/kubectl
4. Test kubectl on your development machine
1$ kubectl version
minikube : Download and Install
After installing kubectl next step would be to install minikube. To begin with the installation first find the latest version
Here is how we need to run the command to install minikube
1curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
2sudo install minikube-linux-amd64 /usr/local/bin/minikube
Break down the long command
1. Download the minikube binaries :
1curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.1.1/minikube-darwin-amd64
Starting : minikube
1. Once your through with installing “kubectl” and “minkube”, now we need to start the minikube
1$ minikube start
1There is a newer version of minikube available (v1.1.1). Download it here:
2https://github.com/kubernetes/minikube/releases/tag/v1.1.1
3
4To disable this notification, run the following:
5minikube config set WantUpdateNotification false
6😄 minikube v1.1.0 on linux (amd64)
7🔥 Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
8🐳 Configuring environment for Kubernetes v1.14.2 on Docker 18.09.6
9🚜 Pulling images ...
10🚀 Launching Kubernetes ...
11⌛ Verifying: apiserver proxy etcd scheduler controller dns
12🏄 Done! kubectl is now configured to use "minikube"
2. Check the status of the minikube
1$ minikube status
1host: Running
2kubelet: Running
3apiserver: Running
4kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
3. Now lets run hellominikube on port 8080
1$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080
2
3kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
4deployment.apps/hello-minikube created
4. Expose the hellominikube service
1$kubectl expose deployment hello-minikube --type=NodePort
2service/hello-minikube exposed
5. Get the pod status
1$ kubectl get pod
2NAME READY STATUS RESTARTS AGE
3hello-minikube-56cdb79778-7v9xt 1/1 Running 0 3m7s
6. Get minikube status
Access the minikube status with url - http://192.168.99.100:31469/
1Hostname: hello-minikube-56cdb79778-7v9xt
2
3Pod Information:
4-no pod information available-
5
6Server values:
7server_version=nginx: 1.13.3 - lua: 10008
8
9Request Information:
10client_address=172.17.0.1
11method=GET
12real path=/
13query=
14request_version=1.1
15request_scheme=http
16request_uri=http://192.168.99.100:8080/
17
18Request Headers:
19accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
20accept-encoding=gzip, deflate
21accept-language=en-US,en;q=0.5
22connection=keep-alive
23host=192.168.99.100:31469
24upgrade-insecure-requests=1
25user-agent=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0
26
27Request Body:
28-no body in request-
7. Delete services of “hello-minikube”
1$ kubectl delete services hello-minikube
2service "hello-minikube" deleted
8. Delete the minikube deployment
1$ kubectl delete deployment hello-minikube
2deployment.extensions "hello-minikube" deleted
9. Stopping the minikube
1$ minikube stop
2✋ Stopping "minikube" in virtualbox ...
3🛑 "minikube" stopped
Learn more On Kubernetes -
- Setup kubernetes on Ubuntu
- Setup Kubernetes on CentOs
- Setup HA Kubernetes Cluster with Kubespray
- Setup HA Kubernetes with Minikube
- Setup Kubernetes Dashboard for local kubernetes cluster
- Setup Kubernetes Dashboard On GCP(Google Cloud Platform)
- How to use Persistent Volume and Persistent Volume Claims in Kubernetes
- Deploy Spring Boot Microservice on local Kubernetes cluster
- Deploy Spring Boot Microservice on Cloud Platform(GCP)
- Setting up Ingress controller NGINX along with HAproxy inside Kubernetes cluster
- CI/CD Kubernetes | Setting up CI/CD Jenkins pipeline for kubernetes
- kubectl export YAML | Get YAML for deployed kubernetes resources(service, deployment, PV, PVC....)
- How to setup kubernetes jenkins pipeline on AWS?
- Implementing Kubernetes liveness, Readiness and Startup probes with Spring Boot Microservice Application?
- How to fix kubernetes pods getting recreated?
- How to delete all kubernetes PODS?
- How to use Kubernetes secrets?
- Share kubernetes secrets between namespaces?
- How to Delete PV(Persistent Volume) and PVC(Persistent Volume Claim) stuck in terminating state?
- Delete Kubernetes POD stuck in terminating state?
Posts in this Series
- Kubernetes Cheat Sheet for day to day DevOps operations?
- Delete Kubernetes POD stuck in terminating state?
- How to Delete PV(Persistent Volume) and PVC(Persistent Volume Claim) stuck in terminating state?
- Share kubernetes secrets between namespaces?
- How to use Kubernetes secrets?
- How to delete all kubernetes PODS?
- kubernetes pods getting recreated?
- Implementing Kubernetes liveness, Readiness and Startup probes with Spring Boot Microservice Application?
- kubectl export yaml OR How to generate YAML for deployed kubernetes resources
- Kubernetes Updates
- CI/CD Kubernetes | Setting up CI/CD Jenkins pipeline for kubernetes
- Kubernetes cluster setup with Jenkins
- How to use Persistent Volume and Persistent Claims | Kubernetes
- How to fix ProvisioningFailed persistentvolume controller no volume plugin matched
- Fixing – Cannot bind to requested volume: storageClasseName does not match
- Fixing – pod has unbound immediate persistentvolumeclaims or cannot bind to requested volume incompatible accessmode
- How to fix kubernetes dashboard forbidden 403 error – message services https kubernetes-dashboard is forbidden User
- How to fix Kubernetes – error execution phase preflight [preflight]
- Deploy Spring Boot microservices on kubernetes?
- How to fix – ansible_memtotal_mb minimal_master_memory_mb
- How to use kubespray – 12 Steps for Installing a Production Ready Kubernetes Cluster
- How to setup kubernetes on CentOS 8 and CentOS 7
- How to fix – How to fix - ERROR Swap running with swap on is not supported. Please disable swap
- 14 Steps to Install kubernetes on Ubuntu 20.04(bento/ubuntu-20.04), 18.04(hashicorp/bionic64)
- Kubernetes Dashboard | Kubernetes Admin GUI | Kubernetes Desktop Client
- Install Kubernetes with Minikube