🚀Day 31 :Launching your First Kubernetes Cluster with Nginx running`

🚀Day 31 :Launching your First Kubernetes Cluster with Nginx running`

😃Table of contents

Welcome to Day 31 of the #90DaysOfDevOps challenge. Today, we will explore the world of Kubernetes and learn how to launch our first Kubernetes cluster using Minikube. Additionally, we will deploy a Nginx pod to get hands-on experience with Kubernetes deployment.

What is Minikube?

Minikube is a powerful tool that allows us to quickly set up a local Kubernetes cluster on our macOS, Linux, or Windows machine. It offers a simplified version of Kubernetes with all its benefits, making it an ideal choice for beginners and projects in edge computing and the Internet of Things (IoT) domain.

Key Features of Minikube:

  • Supports the latest Kubernetes releases, including the previous six minor versions.

  • Cross-platform compatibility for Linux, macOS, and Windows operating systems.

  • Flexible deployment options: VM, container, or bare-metal.

  • Multiple container runtimes supported, including CRI-O, containerd, and Docker.

  • Direct API endpoint for fast image load and build.

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

  • Add-ons for easy installation of Kubernetes applications.

  • Integration with common CI (Continuous Integration) environments.

Understanding Pods

Before we dive into deploying our first pod, let's understand the concept of pods in Kubernetes. Pods are the smallest deployable units of computing in Kubernetes. They represent a group of one or more containers that share storage and network resources. A pod contains a specification for running these containers and ensures that they are co-located and co-scheduled. In simpler terms, a pod can be thought of as an application-specific “logical host” that tightly couples one or more containers.

For a more in-depth understanding of pods, you can refer to the Kubernetes documentation.

Task 1: Install Minikube on your Local Machine

  • Visit the official Minikube documentation at minikube.sigs.k8s.io/docs/startto access the installation instructions.

  • Follow the installation instructions based on your operating system (macOS, Linux, or Windows) to download and install Minikube.

  • Once the installation is complete, verify the installation by opening a terminal or command prompt and running the following command:

COPY

minikube version

If Minikube is installed correctly, you will see the version information displayed.

Task 2: Creating your First Pod with Minikube

Launch your Minikube cluster by opening a terminal or command prompt and running the following command:

COPY

minikube start

This command will start a local Kubernetes cluster using Minikube.

Verify that your Minikube cluster is running by running the following command:

COPY

kubectl cluster-info

You should see information about your Minikube cluster, including the Kubernetes master URL.

Deploy a Nginx pod by creating the below 'pod.yml' in your workspace:

COPY

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80

And running this command:

COPY

kubectl apply -f pod.yml

This command creates a pod named “nginx” and uses the official Nginx Docker image.

Verify that the Nginx pod is running by running the following commands:

COPY

kubectl get pods
kubectl describe pod nginx

You should see the Nginx pod listed with a status of “Running”.

Congratulations on taking the first steps towards mastering Kubernetes. Stay tuned for Day 32 of the #90DaysOfDevOps challenge, where we will continue exploring Kubernetes and dive deeper into its advanced features.