Day 31 - Launching your First Kubernetes Cluster with Nginx running

Day 31 - 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

(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, containers, 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:

Minikube Installation

For installation, of Minikube visit this page.

Kubectl, you can check this.

  1. Let's install Minikube

     curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
     sudo install minikube-linux-amd64 /usr/local/bin/minikube
    

  2. Start the Minikube and install kubectl

     minikube start --driver=docker
     sudo snap install kubectl --classic
    

Minikube starts only a single node cluster with this command

We have successfully installed Minikube, now we can deploy PODS.


Let's understand the concept of Pod

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.

You can read more about Pod from here

Task-02:

Create your first pod on Kubernetes through Minikube.

We are suggesting you make an Nginx pod, but you can always show your creativity and do it on your own.

vi pod.yaml

apiVersion: v1
kind: Pod
metadata:
   name: nginx
spec:
   containers:
    - name: nginx
      image: nginx:latest
      ports:
      - containerPort: 80
kubectl apply -f pod.yaml
kubectl get pods

sudo apt-get install curl

To access the Nginx in Minikube

# Pod information
$ kubectl get pods -o wide

# Get into miniKube
$ minikube ssh

# Access Nginx
$ curl <podIP>

Type Exit -- To get out of minikube ssh

# Delete a pod
$ kubectl delete pod <PODname>

Happy Learning