Minikube Installation
Launching your First Kubernetes Cluster with React-Django running
Awesome! You learned the architecture of one of the top most important tool "Kubernetes".
What about doing some hands-on now?
Let's read about minikube and implement k8s in our local machine
- What is minikube?
Ans:- Minikube is a tool which quickly sets up a local Kubernetes cluster on macOS, Linux, and Windows. It can deploy as a VM, a container, or on bare-metal.
Minikube is a pared-down version of Kubernetes that gives you all the benefits of Kubernetes with a lot less effort.
This makes it an interesting option for users who are new to containers, and also for projects in the world of edge computing and the Internet of Things.
- Features of minikube
Ans :-
(a) Supports the latest Kubernetes release (+6 previous minor versions)
(b) Cross-platform (Linux, macOS, Windows)
(c) Deploy as a VM, a container, or on bare-metal
(d) Multiple container runtimes (CRI-O, containerd, docker)
(e) Direct API endpoint for blazing fast image load and build
(f) Advanced features such as LoadBalancer, filesystem mounts, FeatureGates, and network policy
(g) Addons for easily installed Kubernetes applications
(h) Supports common CI environments
Task-01:
Install minikube on your local
Update the system.
sudo apt update
Installing docker on local
sudo apt install -y docker.io
Start docker.
sudo systemctl start docker
-Error as I am running Ubuntu is running on Windows.
Run commands to fix the errors.
sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target
sudo -E nsenter --all -t $(pgrep -xo systemd) runuser -P -l $USER -c "exec $SHELL"
Start docker.
sudo systemctl start docker
Enable docker every time the system restarts
sudo systemctl enable docker
Adding a current user to docker group to prevent permission denied error.
sudo usermod -aG docker $USER and newgrp docker
sudo reboot
Downloading minicube.
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
List all the files.
ls : minikube file has been downloaded
Changing file permission to make it executable and moving the file minikube to bin folder
chmod +x minikube
sudo mv minikube /usr/local/bin/
Check minikube is working.
Download kubectl
curl -LO "[https://dl.k8s.io/release/$(curl](https://dl.k8s.io/release/$(curl) -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl/bin/linux/amd64/kubectl)"
Changing kubectl file permission to be executable and moving it to bin folder.
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
Start minicube.
minikube start --driver=docker
View all the running container.
docker ps: minicube container is running.
Go inside the minikube container and view all the container.
minikube ssh:to go inside the minikube container
docker ps : view all the running container in minikube
To view all the nodes
kubectl get nodes
To view the pods.
kubectl get pods
Task-02:
Create your first pod on Kubernetes through minikube.
Create a namespace.
kubectl create namespace react-django-ns
To view namespaces.
kubectl get namespaces
Creating a directory and create a pod.yaml file
mkdir django-project-k8
touch pod.yaml
vim pod.yaml and cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: django
namespace: react-django-ns
spec: containers:
name: django-ctr image: django ports:
- containerPort: 80
Create pod from pod.yaml file
kubectl apply -f pod.yaml
To view the pods.
kubectl get pods : As no pods are created in default namespace
kubectl get pods --namespace=react-django-ns
To view the IP address of the pod.
kubectl get pods --namespace=react-django-ns -o wide
To view the detailed information of the pod.
kubectl describe pod --namespace=react-django-ns
To delete the pod.
kubectl delete pod --namespace=react-django-ns
For installation, you can Visit this page.
If you want to try an alternative way, you can check this.
Let's understand the concept pod
Ans:-
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers that are relatively tightly coupled.
Installation of minikube on local.
Happy Learning :)




