Your First Lab
This page walks you through the Simple App lab, your first Deployment and Service. By the end, you will have nginx running in a dedicated namespace with two replicas.
Make sure you have completed the Installation & Setup first.
What You Will Deploy
Section titled “What You Will Deploy”A simple nginx web server with:
- A Deployment that manages 2 replicas
- A Service that provides a stable network endpoint
- Resource requests and limits on every container
- Everything in its own namespace (not the default namespace)
Step 1: Navigate to the repo
Section titled “Step 1: Navigate to the repo”cd k8s-learn-by-doingStep 2: Create the namespace
Section titled “Step 2: Create the namespace”Every lab uses a dedicated namespace. This keeps resources isolated and makes cleanup simple.
kubectl apply -f demos/simple-app/manifests/namespace.yamlStep 3: Deploy all manifests
Section titled “Step 3: Deploy all manifests”kubectl apply -f demos/simple-app/manifests/This applies the Deployment and Service in a single command.
Step 4: Check the pods
Section titled “Step 4: Check the pods”kubectl get pods -n simple-appYou should see two pods with status Running:
NAME READY STATUS RESTARTS AGEsimple-nginx-6d4f5b7c8-abc12 1/1 Running 0 10ssimple-nginx-6d4f5b7c8-def34 1/1 Running 0 10sStep 5: Access the application
Section titled “Step 5: Access the application”kubectl port-forward svc/simple-nginx-service 8080:80 -n simple-appOpen http://localhost:8080 in your browser. You should see the default nginx welcome page.
Press Ctrl+C to stop the port-forward when you are done.
What Just Happened
Section titled “What Just Happened”You created three Kubernetes resources:
- Namespace (
simple-app): An isolated space for this lab’s resources - Deployment (
simple-nginx): Tells Kubernetes to run 2 copies of nginx:1.25.3-alpine with 50m CPU and 64Mi memory limits - Service (
simple-nginx-service): A stable ClusterIP address that routes traffic to whichever pods are running
The Deployment controller watches for pod failures and recreates them automatically. Try deleting a pod:
kubectl delete pod -l app=simple-nginx -n simple-app --wait=falsekubectl get pods -n simple-app -wA new pod appears immediately. That is the Deployment controller doing its job.
Step 6: Clean up
Section titled “Step 6: Clean up”kubectl delete namespace simple-appDeleting the namespace removes everything inside it. No leftover resources.
What to Do Next
Section titled “What to Do Next”You just completed your first lab. Here are two paths forward:
- Follow the Beginner Track: Go to Learning Tracks and follow the recommended order
- Jump into the Simple App lab details: Read the full the Simple App lab page for the complete experiment section
- Browse all labs: Pick any lab from the sidebar that interests you