In this article we are going to cover How to Install Minikube on Ubuntu 20.04 LTS AWS EC2 and deploy an app on Kubernetes cluster using Minikube.
Table of Contents
What is Minikube in Kubernetes ?
Minikube creates a single node cluster inside a VM or Cloud Instance. It is good for beginners to learn Kubernetes since you don’t have to create a master and worker node to create a cluster and we can practice basic Kubernetes functions and can also install the Kubernetes dashboard on it.
Minikube System Requirements
- Minimum 2 CPU’s or more
- Minimum 2GB of free memory
- Minimum 20GB of free disk space
- Internet connection
- Container or virtual machine manager, such as: Docker, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation
Update the system packages on Ubuntu EC2
sudo apt update
#1.Install kubectl on Ubuntu 20.04 LTS
Download kubectl binary with curl on Ubuntu using below 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
Make the kubectl binary executable
chmod +x ./kubectl
Move kubectl to /usr/local/bin/kubectl directory
sudo mv ./kubectl /usr/local/bin/kubectl
To check kubectl version on Ubuntu
kubectl version
Output:
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:48:33Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}
#2.Install Docker on Ubuntu 20.04 LTS
Install Docker on Ubuntu 20.04 LTS using below command
sudo apt-get install docker.io -y
To check docker service status on Ubuntu
sudo systemctl status docker
Configure to Run docker without sudo permission
sudo usermod -aG docker $USER && newgrp docker
#3.Download and Install Minikube on Ubuntu 20.04 LTS
Download and Install Minikube on Ubuntu 20.04 LTS using below commands, To download latest minikube setup refer minikube official download page
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
Make the minikube binary executable
chmod +x minikube
Move minikube to /usr/local/bin/kubectl directory
sudo mv minikube /usr/local/bin/
To check minikube version on ubuntu
minikube version
Output:
minikube version: v1.24.0
commit: 76b94fb3c4e8ac5062daf70d60cf03ddcc0a741b
Start the minikube Kubernetes cluster on Ubuntu
sudo minikube start --vm-driver=none
OR
sudo minikube start --vm-driver=none --wait=false
Error:
minikube v1.24.0 on Ubuntu 20.04 (xen/amd64)
Using the none driver based on user configuration
X Exiting due to GUEST_MISSING_CONNTRACK: Sorry, Kubernetes 1.22.3 requires conntrack to be installed in root's path
Solution:
sudo apt-get install -y conntrack
Now start the minikube on Ubuntu
minikube start --vm-driver=none
Output:
* minikube v1.24.0 on Ubuntu 20.04 (xen/amd64)
* Using the none driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Running on localhost (CPUs=2, Memory=3928MB, Disk=19788MB) ...
* OS release is Ubuntu 20.04.3 LTS
* Preparing Kubernetes v1.22.3 on Docker 20.10.7 ...
- kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
> kubectl.sha256: 64 B / 64 B [--------------------------] 100.00% ? p/s 0s
> kubelet.sha256: 64 B / 64 B [--------------------------] 100.00% ? p/s 0s
> kubeadm.sha256: 64 B / 64 B [--------------------------] 100.00% ? p/s 0s
> kubectl: 44.73 MiB / 44.73 MiB [------------] 100.00% 66.30 MiB p/s 900ms
> kubeadm: 43.71 MiB / 43.71 MiB [-------------] 100.00% 48.59 MiB p/s 1.1s
> kubelet: 115.57 MiB / 115.57 MiB [-----------] 100.00% 69.82 MiB p/s 1.9s
- Generating certificates and keys ...
- Booting up control plane ...
- Configuring RBAC rules ...
* Configuring local host environment ...
*
! The 'none' driver is designed for experts who need to integrate with an existing VM
* Most users should use the newer 'docker' driver instead, which does not require root!
* For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/
*
! kubectl and minikube configuration will be stored in /home/ubuntu
! To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:
*
- sudo mv /home/ubuntu/.kube /home/ubuntu/.minikube $HOME
- sudo chown -R $USER $HOME/.kube $HOME/.minikube
*
* This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
To Check the status of Minikube
minikube status
Output:
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
To check Minikube cluster information
kubectl cluster-info
Output:
Kubernetes control plane is running at https://172.31.4.153:8443
CoreDNS is running at https://172.31.4.153:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
To view minikube cluster events
kubectl get events
To view the kubectl configuration
kubectl config view
Output:
apiVersion: v1
clusters:
- cluster:
certificate-authority: /home/ubuntu/.minikube/ca.crt
extensions:
- extension:
last-update: Thu, 25 Nov 2021 14:45:29 UTC
provider: minikube.sigs.k8s.io
version: v1.24.0
name: cluster_info
server: https://172.31.4.153:8443
name: minikube
contexts:
- context:
cluster: minikube
extensions:
- extension:
last-update: Thu, 25 Nov 2021 14:45:29 UTC
provider: minikube.sigs.k8s.io
version: v1.24.0
name: context_info
namespace: default
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
user:
client-certificate: /home/ubuntu/.minikube/profiles/minikube/client.crt
client-key: /home/ubuntu/.minikube/profiles/minikube/client.key
Lets create first container on Minikube Cluster using kubectl
kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
To check pods on minikube using kubectl command
kubectl get pods
Output:
kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-minikube 1/1 Running 0 37s
We have covered Install Minikube on Ubuntu.
#4:Deploy an app on Minikube Cluster
Lets create deployment on Minikube cluster
kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
To check deployment on minikube cluster
kubectl get deployment
Output:
kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
hello-node 1/1 1 1 31s
Expose the deployment using service on minikube cluster
kubectl expose deployment hello-node --type=NodePort --port=8080
To check service on minikube cluster using kubectl
kubectl get svc
Output:
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-node NodePort 10.111.170.87 <none> 8080:32548/TCP 26s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 11m
Access the app on minikube cluster using cluster IP
curl -v 13.234.67.176:32548
Output:
* Trying 13.234.67.176:32548...
* TCP_NODELAY set
* Connected to 13.234.67.176 (13.234.67.176) port 32548 (#0)
> GET / HTTP/1.1
> Host: 13.234.67.176:32548
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.10.0
< Date: Thu, 25 Nov 2021 14:59:53 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Connection: keep-alive
<
CLIENT VALUES:
client_address=172.17.0.1
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://13.234.67.176:8080/
SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001
HEADERS RECEIVED:
accept=*/*
host=13.234.67.176:32548
user-agent=curl/7.68.0
BODY:
* Connection #0 to host 13.234.67.176 left intact
we can access it within the cluster via $(minikube ip):$NODE_PORT
To check minikube internal IP
minikube ip
curl -v 172.31.4.153:32548
To access app on browser using node port
http://13.234.67.176:32548/
Output:

To delete service on minikube cluster using kubectl
kubectl delete service hello-node
To delete deployment on minikube cluster using kubectl
kubectl delete deployment hello-node
To stop minikube cluster
minikube stop
Output:
* Stopping node "minikube" ...
* 1 node stopped.
To delete minikube cluster
minikube delete
Output:
* Uninstalling Kubernetes v1.22.3 using kubeadm ...
* Deleting "minikube" in none ...
* Removed all traces of the "minikube" cluster.
Conclusion:
In this article we have covered How to Install Minikube on Ubuntu 20.04 LTS AWS EC2 and deploy an app on Kubernetes cluster using Minikube.
Related Articles: