Day 31 Task: Launching your First Kubernetes Cluster with Nginx running
Task 1: Installing Minikube
What is Minikube? Minikube is your go-to tool for setting up a local Kubernetes cluster effortlessly. It's perfect for:
Beginners to Kubernetes.
Testing and development on your local machine.
Exploring edge computing and IoT projects.
Key Features of Minikube:
Supports the latest Kubernetes versions.
Cross-platform support for Linux, macOS, and Windows.
Versatile deployment as VM, container, or bare-metal.
Advanced features like LoadBalancer and Addons.
Installation:
Visit the Minikube installation guide.
Follow the steps based on your operating system.
Task 2: Creating Your First Pod
Understanding Pods:
A Pod is the smallest deployable unit in Kubernetes.
It contains one or more containers, shared storage, and network resources.
Think of it as a "logical host" for your application.
Create an Nginx Pod with Minikube:
1. Start Minikube
minikube start\
- Check minikube status
3. Create a file nginx-pod.yaml with the following content:
-
4. Apply the configuration:
kubectl apply -f ngnix-pod.yml
- Check the pod status:
kubectl get pods
6. Access the pod:
kubectl port-forward pod/nginx-pod 8080:80
Make sure if you are using EC-2 instance you expose the port 8080 in your EC-2 machine
- Open your browser at
http://localhost:8080
.