Day 31 Task: Launching your First Kubernetes Cluster with Nginx running

Day 31 Task: Launching your First Kubernetes Cluster with Nginx running

What is minikube?

Minikube is a tool that 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:

  1. Supports the latest Kubernetes release (+6 previous minor versions)

  2. Cross-platform (Linux, macOS, Windows)

  3. Deploy as a VM, a container, or on bare-metal

  4. Multiple container runtimes (CRI-O, containers, docker)

  5. Direct API endpoint for blazing-fast image load and build

  6. Advanced features such as LoadBalancer, filesystem mounts, FeatureGates, and network policy

  7. Addons for easily installed Kubernetes applications

  8. Supports common CI environments

Task-01: Install minikube on your local.

Step 1: Update your operating system.

sudo apt update

Step 2: Install the required packages.

sudo apt install -y curl wget apt-transport-https

Step 3: Install docker.

sudo apt install -y docker.io
sudo systemctl enable --now docker 
sudo usermod -aG docker $USER && newgrp docker

Step 4: Install minikube.

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

Step 5: Install kubectl.

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

Step 6: Make it executable and move it into your path:

chmod +x kubectl
sudo mv kubectl /usr/local/bin/

Step 7: Start minikube.

minikube start --driver=docker

Step 8: Check cluster status.

minikube status

Task 2: Create your first pod on Kubernetes through minikube

Step 1: First create a namespace named nginx.

kubectl create namespace nginx

Step 2: Write a config file or yaml file for pod creation.

Step 3: Use kubectl apply command to create or modify Kubernetes resources defined in a manifest file.

kubectl apply -f pod.yml

Step 4: Here it is. Your pod is created successfully.