Recently, I revisited Kubernetes to strengthen my DevOps skills and document the process. Here’s my step-by-step journey deploying Nginx locally with Minikube.

1. Setting Up the Cluster with Minikube
Kubernetes requires a cluster to run workloads. For local development, I used Minikube to simulate a real cluster:
minikube start
This command spun up:
- A control plane
- A single worker node
- All necessary Kubernetes components
Verify the cluster:
kubectl get nodes
2. Creating and Deploying Nginx
I defined the deployment in nginx-deployment.yml
:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:latest ports: - containerPort: 80
Applied it with:
kubectl apply -f nginx-deployment.yml
3. Exposing the Nginx Service
Pods are only accessible within the cluster by default. To expose Nginx, I created a NodePort
service (nginx-service.yaml
):
apiVersion: v1 kind: Service metadata: name: nginx-service spec: type: NodePort selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80
Deployed it with:
kubectl apply -f nginx-service.yaml
4. Accessing Nginx
- Get the Minikube IP:shCopyDownloadminikube ip # Example output: 192.168.49.2
- Find the NodePort:shCopyDownloadkubectl get svc nginx-serviceExample output:CopyDownloadNAME TYPE PORT(S) nginx-service NodePort 80:30080/TCP
- Access Nginx at:CopyDownloadhttp://<minikube-ip>:<nodePort> # Example: http://192.168.49.2:30080
5. Git Management
- Tracked all YAML files in Git
- Pushed changes to GitHub
- Learned to clean up remote branches
Key Learnings
✅ Kubernetes architecture: clusters → nodes → pods → containers
✅ Service types: ClusterIP vs. NodePort vs. LoadBalancer
✅ Declarative infrastructure with YAML + kubectl
✅ DevOps workflow best practices
Next Steps
- Scaling deployments (
kubectl scale
) - Rolling updates
- ConfigMaps & Secrets
- Helm charts
Project Files: GitHub Repo Link