ππ Day 57 DevOps Challenge - π Launching Your First Kubernetes Cluster with Nginx: A Minikube Adventure! π οΈ

Passionate software engineering student | DevOps enthusiast | Seeking innovation and excellence in software engineering! π¨βπ»
In your previous learning, you gained insights into the architecture of Kubernetes, a fundamental tool in the world of container orchestration. Now, it's time to get hands-on experience and delve into the practical aspects of Kubernetes. We'll start by exploring Minikube, a tool that simplifies setting up a local Kubernetes cluster for development and testing purposes. Let's embark on this exciting adventure! π
What is Minikube? π
Minikube is a powerful tool designed to swiftly set up a local Kubernetes cluster on macOS, Linux, and Windows. It offers the benefits of Kubernetes in a simplified, easy-to-use package, making it an excellent choice for newcomers to the world of containers and developers working on edge computing and IoT projects. Let's uncover the features that make Minikube a go-to option for developers! π‘οΈ
Features of Minikube:
Supports the latest Kubernetes release: Minikube supports the latest Kubernetes release, along with six previous minor versions.
Cross-platform: It can be used on Linux, macOS, and Windows.
Flexible deployment options: Minikube can be deployed as a VM, a container, or on bare-metal, offering flexibility based on your needs.
Multiple container runtimes: It supports various container runtimes like CRI-O, containerd, and Docker.
Direct API endpoint: Provides a direct API endpoint for fast image load and build.
Advanced features: Offers advanced features like LoadBalancer, filesystem mounts, FeatureGates, and network policy.
Addons for Kubernetes applications: Easily install Kubernetes applications using addons.
Compatibility with common CI environments: Minikube is compatible with common CI environments, enhancing its usability for developers.
Installing Minikube on Ubuntu π³
This guide provides step-by-step instructions for installing Minikube on Ubuntu. Minikube allows you to run a single-node Kubernetes cluster locally for development and testing purposes.
Task-01: Install Minikube on your local machine or AWS EC2 instance π»
To get started, let's install Minikube on your local machine. Before you begin, ensure that you have the following prerequisites:
Prerequisites:
2 CPUs or more
2GB of free memory
20GB of free disk space
Internet connection
Container or virtual machine manager, such as: Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation
I'm using an EC2 instance to install and run Minikube.
Preparing Your EC2 Instance π
If you prefer using an EC2 instance for Minikube, ensure that you choose an instance type that meets the requirements:
- Instance Type: t2.medium (2 vCPUs, 4 GB RAM)
By selecting an EC2 instance with these specifications, you can have a seamless experience running Minikube on AWS.
Installation Steps:
Create an EC2 Instance: Create a t2.medium EC2 instance on AWS.



Update and Download kubectl: Update the instance and download
kubectlusing the following commands:sudo apt-get update ## Download the latest release with the command curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" ## Download the kubectl checksum file curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" ## Validate the kubectl binary against the checksum file echo "$(cat kubectl.sha256) kubectl" | sha256sum --check ## If valid, the output is: kubectl: OK ## Install kubectl sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl ## Test to ensure the version you installed is up-to-date: kubectl version --client
Install Docker: Minikube can run a Kubernetes cluster either in a VM or locally via Docker. This guide demonstrates the Docker method.
Install, Start and enable Docker:
sudo apt install -y docker.io sudo systemctl start docker sudo systemctl enable docker

Add the current user to the docker group (To use Docker without root):
sudo usermod -aG docker $USER && newgrp dockerLogout and log back in for the changes to take effect:
exit
Reconnect to your instance.
Install Minikube: Install Minikube using the following command:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
Now you have Minikube installed on your EC2 instance. You can proceed to start Minikube and set up your local Kubernetes cluster.
Start Minikube: Now, you can start Minikube with the following command:
minikube start --driver=docker

This command will start a single-node Kubernetes cluster inside a Docker container.
Task-02: Create your first Pod on Kubernetes using Minikube ποΈ
Now, let's put our knowledge into action and create our first Pod in Kubernetes using Minikube. We'll start by creating an Nginx pod, a popular web server. Let's roll up our sleeves and get our hands dirty with some Kubernetes magic! πͺ
Creating an Nginx Pod
To create an Nginx Pod, follow these steps:
Create a YAML configuration file named
pod.yamland copy the following content into it:apiVersion: v1 kind: Pod metadata: name: nginx-pod spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80

Apply the configuration using the
kubectlcommand:kubectl apply -f pod.yaml

This YAML defines a Pod named
nginx-podrunning the latest version of the Nginx container.To access the Nginx Pod, run the following command to access the Minikube VM:
minikube sshOnce inside the Minikube VM, you can use
curlto access the Pod's IP address. Replace<pod_ip_address>with the actual IP address of your Pod.## To get pod_ip_address run -- kubectl get pods -o wide -- curl <pod_ip_address>
Congratulations on reaching this exciting milestone in your Kubernetes journey! Stay tuned for more tutorials and insights into the fascinating world of Kubernetes. Happy coding! π




