Day 31- Launching Your First Kubernetes Cluster with Minikube: A Hands-On Experience  (Dec 27, 2023)

Day 31- Launching Your First Kubernetes Cluster with Minikube: A Hands-On Experience (Dec 27, 2023)

Introduction:

Welcome to Day 31 of the #90DaysOfDevOps Challenge! Today, we're diving into hands-on Kubernetes deployment using Minikube—a lightweight tool that simplifies the process of setting up a local Kubernetes cluster on macOS, Linux, and Windows. By the end of this blog, you'll have your first Kubernetes cluster running, with an Nginx pod serving as your introductory containerized application.

What is Minikube?

Minikube is a versatile tool designed to swiftly set up a local Kubernetes cluster. Whether you're a Kubernetes beginner or exploring container orchestration for edge computing and the Internet of Things (IoT), Minikube offers an effortless way to experience the power of Kubernetes on your local machine.

Features of Minikube:

  1. Latest Kubernetes Release Support: Minikube supports the latest Kubernetes release and six previous minor versions.

  2. Cross-Platform Compatibility: It is cross-platform, catering to users on Linux, macOS, and Windows.

  3. Deployment Options: Choose to deploy Minikube as a virtual machine, a container, or directly on bare-metal.

  4. Multiple Runtimes: Minikube supports various container runtimes such as CRI-O, containerd, and Docker.

  5. Direct API Endpoint: Facilitates a direct API endpoint for rapid image load and build.

  6. Advanced Features: Includes advanced features like LoadBalancer, filesystem mounts, FeatureGates, and network policy.

  7. Addons: Minikube offers easy installation of Kubernetes applications through addons.

  8. CI Environment Compatibility: Minikube seamlessly integrates with common CI environments.

Task-01: Install kubeadm on Your Local Machine

To embark on this hands-on journey, begin by installing Minikube on your local machine. You can follow the installation instructions on the official Minikube documentation page.

Understanding the Concept of Pods

Before we proceed with creating our first pod, let's grasp the concept of a Pod in Kubernetes:

Pods are the fundamental deployable units in Kubernetes. A Pod can consist of one or more containers, sharing the same storage and network resources. They are co-located, co-scheduled, and run in a shared context. Think of a Pod as a logical host for one or more application containers.

Task-02: Create Your First Pod on Kubernetes via kubeadm

Now, let's put our knowledge into action by creating our first pod. In this example, we'll create an Nginx pod, but feel free to get creative with your own choices.

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
spec:
  containers:
    - name: nginx-container
      image: nginx:latest

Save the above YAML definition in a file (e.g., nginx-pod.yaml) and apply it to create the pod:

kubectl apply -f nginx-pod.yaml

This YAML defines a simple pod named "nginx-pod" with an Nginx container.