Skip to content

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.

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)
Terminal window
cd k8s-learn-by-doing

Every lab uses a dedicated namespace. This keeps resources isolated and makes cleanup simple.

Terminal window
kubectl apply -f demos/simple-app/manifests/namespace.yaml
Terminal window
kubectl apply -f demos/simple-app/manifests/

This applies the Deployment and Service in a single command.

Terminal window
kubectl get pods -n simple-app

You should see two pods with status Running:

NAME READY STATUS RESTARTS AGE
simple-nginx-6d4f5b7c8-abc12 1/1 Running 0 10s
simple-nginx-6d4f5b7c8-def34 1/1 Running 0 10s
Terminal window
kubectl port-forward svc/simple-nginx-service 8080:80 -n simple-app

Open 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.

You created three Kubernetes resources:

  1. Namespace (simple-app): An isolated space for this lab’s resources
  2. Deployment (simple-nginx): Tells Kubernetes to run 2 copies of nginx:1.25.3-alpine with 50m CPU and 64Mi memory limits
  3. 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:

Terminal window
kubectl delete pod -l app=simple-nginx -n simple-app --wait=false
kubectl get pods -n simple-app -w

A new pod appears immediately. That is the Deployment controller doing its job.

Terminal window
kubectl delete namespace simple-app

Deleting the namespace removes everything inside it. No leftover resources.

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