Skip to main content

Command Palette

Search for a command to run...

Minikube Installation

Published
•4 min read•View as Markdown

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

  1. 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.

  1. 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

image

  • Installing docker on local

sudo apt install -y docker.io

image

  • Start docker.

sudo systemctl start docker

-Error as I am running Ubuntu is running on Windows.

image

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"

image

  • Start docker.

sudo systemctl start docker

image

  • Enable docker every time the system restarts

sudo systemctl enable docker

image

  • Adding a current user to docker group to prevent permission denied error.

sudo usermod -aG docker $USER and newgrp docker

sudo reboot

image

  • Downloading minicube.

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

image

  • List all the files.

ls : minikube file has been downloaded

image

  • Changing file permission to make it executable and moving the file minikube to bin folder

chmod +x minikube

sudo mv minikube /usr/local/bin/

image

  • Check minikube is working.

image

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)"

image

  • Changing kubectl file permission to be executable and moving it to bin folder.

chmod +x kubectl

sudo mv kubectl /usr/local/bin/

image

  • Start minicube.

minikube start --driver=docker

image

  • View all the running container.

docker ps: minicube container is running.

image

  • 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

image

  • To view all the nodes

kubectl get nodes

image

  • To view the pods.

kubectl get pods

image

Task-02:

Create your first pod on Kubernetes through minikube.

  • Create a namespace.

kubectl create namespace react-django-ns

image

  • To view namespaces.

kubectl get namespaces

image

  • Creating a directory and create a pod.yaml file

mkdir django-project-k8

touch pod.yaml

image

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

image

  • Create pod from pod.yaml file

kubectl apply -f pod.yaml

image

  • To view the pods.

kubectl get pods : As no pods are created in default namespace

image

kubectl get pods --namespace=react-django-ns

image

  • To view the IP address of the pod.

kubectl get pods --namespace=react-django-ns -o wide

image

  • To view the detailed information of the pod.

kubectl describe pod --namespace=react-django-ns

image

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 :)

More from this blog

Untitled Publication

32 posts