Day31:Launching your First Kubernetes Cluster with Nginx running

Day31:Launching your First Kubernetes Cluster with Nginx running

Let's read about minikube and implement k8s in our local machine

What is minikube?

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

(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

For installation, you can Visit this page.

If you want to try an alternative way, you can check this.

Install minikube on Linux, for installation use minikube site

Launch EC2 instance with Instance type as “t2.medium”. Install docker by using commands such as “sudo apt-get update” and “sudo apt-get install docker.io”.

Install minikube using linux commands such as “curl -LO storage.googleapis.com/minikube/releases/la..” and “sudo install minikube-linux-amd64 /usr/local/bin/minikube

To confirm successful installation of both a hypervisor and Minikube, you can run the following command to start up a local Kubernetes cluster:

minikube start - download Kubernetes for you

minikube start --driver=<driver_name>

In below image, we used driver_name=docker, so first you need to install docker in your machine.

Once minikube start finishes, run the command below to check the status of the cluster:

minikube status

If you have previously installed Minikube, and run:

minikube start

and minikube start returned an error:

machine does not exist

then you need to clear minikube local state:

minikube delete

For log in to minikube use command:

minikube ssh

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.

Task-02:

Create your first pod on Kubernetes through minikube.

Install kubectl using command

sudo snap install kubectl --classic

Create a folder, inside folder create pod.yaml file for nginx.

To create a pod using pod.yaml file use below command:

kubectl apply -f <pod.yaml>

To check list of pods:

kubectl get pods

You can check nginx container is created and running.

Thank you for reading!! I hope you find this article helpful!!

Happy Learning!!

Sayali✨

Did you find this article valuable?

Support Sayali Jadhav by becoming a sponsor. Any amount is appreciated!