Skip to main content

Command Palette

Search for a command to run...

๐Ÿš€Launching Your First Kubernetes Cluster with Kind & Nginx

Creating a Kubernetes Cluster Using Kind & creating Nginx pod

Published
โ€ข2 min read
๐Ÿš€Launching Your First Kubernetes Cluster with Kind & Nginx
A

๐Ÿ‘จโ€๐Ÿ’ป Last-year student diving deep into DevOps, Cloud Engineering, and Infrastructure Automation. Passionate about building scalable, efficient, and secure systems. Letโ€™s connect and build something amazing! ๐Ÿš€

Let's take it a step further with hands-on practice by setting up a Kubernetes cluster using Kind (Kubernetes in Docker) and creating Nginx pod as our first pod! ๐Ÿš€


๐Ÿ” What is Kind?

Kind (Kubernetes in Docker) is a lightweight tool that lets you quickly create Kubernetes clusters inside Docker containers. It's a great alternative to Minikube for local development, testing, and CI/CD pipelines.

โœจ Features of Kind:

โœ… Runs Kubernetes inside Docker ๐Ÿณ
โœ… Lightweight & fast ๐Ÿš€
โœ… Supports multiple Kubernetes versions
โœ… Works on Linux, macOS, and Windows
โœ… Perfect for testing Kubernetes workloads locally


๐Ÿ› ๏ธ Task-01: Install Kind

๐Ÿ”น First, install Kind by following the official guide: Kind Installation.
๐Ÿ”น Ensure Docker is installed before proceeding.

โœ… Create a Kind Cluster

Once installed, create a Kubernetes cluster using:

kind create cluster --name my-cluster

To verify, run:

kubectl cluster-info --context kind-my-cluster

๐Ÿ”น Understanding Kubernetes Pods

๐Ÿค” What is a Pod?

A Pod is the smallest deployable unit in Kubernetes. It consists of:

  • One or more containers ๐Ÿณ

  • Shared storage & network

  • A specification defining how to run the containers

A Pod acts as a "logical host", ensuring all its containers run together efficiently.


๐Ÿ› ๏ธ Task-02: Create a Pod Definition (nginx-pod.yaml)

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  labels:
    app: nginx
spec:
  containers:
    - name: nginx-container
      image: nginx:latest
      ports:
        - containerPort: 80

๐Ÿ›  Explanation:

  1. apiVersion: v1 โ†’ Uses v1 API for Kubernetes objects.

  2. kind: Pod โ†’ Defines this as a Pod resource.

  3. metadata:

    • name: nginx-pod โ†’ Assigns a name to the Pod.

    • labels: app: nginx โ†’ Adds a label for easy identification.

  4. spec:

    • containers โ†’ Lists the containers within the pod.

    • name: nginx-container โ†’ Names the container inside the pod.

    • image: nginx:latest โ†’ Uses the latest Nginx Docker image.

    • ports: containerPort: 80 โ†’ Exposes port 80 for web traffic (HTTP).

โœ… Apply the YAML file

kubectl apply -f nginx-pod.yaml

Check if the Pod is running:

kubectl get pods

๐ŸŽ‰ Congrats! You've successfully created an Nginx Pod.