Lab: Kubernetes basics with minikube
In short: minikube gives you a free single-node Kubernetes cluster on your own computer. In this lab you create a Deployment, scale it, expose it, see the reconciliation loop replace a deleted pod and remove the whole cluster with one command.
Aim and what you need
The aim is to learn the core Kubernetes objects by using them: Pods (one or more containers), Deployments (which keep a set number of pods running) and Services (a stable address in front of pods). A local cluster costs nothing and you can break it freely.
- A computer with at least 2 CPUs, 4 GB of free RAM and 20 GB disk.
- Docker installed (see your first Docker container), or a supported hypervisor.
- minikube and
kubectl, installed from the official Kubernetes and minikube instructions for your operating system.
Steps
- Start the cluster with the Docker driver and check the node is Ready.
- Create a Deployment called
hellousing the nginx image. - Scale it to three replicas and watch the pods appear.
- Expose it as a NodePort Service and open the URL minikube gives you.
- Delete one pod and watch a replacement start.
- Export the Deployment as YAML (YAML Ain't Markup Language) to see the declarative form.
minikube start --driver=docker --cpus=2 --memory=4096
kubectl get nodes
kubectl create deployment hello --image=nginx:alpine
kubectl get deployments,pods -o wide
kubectl scale deployment hello --replicas=3
kubectl get pods -w
kubectl expose deployment hello --type=NodePort --port=80
kubectl get service hello
minikube service hello --url
kubectl delete pod <one-of-the-hello-pod-names>
kubectl get pods
kubectl describe deployment hello
kubectl get deployment hello -o yaml
kubectl logs deployment/hello
How to verify and troubleshoot
Three pods should show Running, and the Service should list three endpoints (kubectl get endpoints hello). The URL from minikube service should show the nginx page. After you delete a pod, a new one with a different name should appear within seconds, because the Deployment's controller sees only two pods where you asked for three.
- Pod stuck in ImagePullBackOff: check the image name and your internet connection;
kubectl describe podshows the exact error. - minikube will not start: make sure Docker is running and you gave enough memory;
minikube logshelps. - Service URL does not load: on Docker Desktop the
minikube servicecommand may need to keep running in its terminal to hold the tunnel open. - kubectl talks to the wrong cluster: run
kubectl config current-context; it should sayminikube. This matters if you also have work clusters configured.
Clean-up and next steps
kubectl delete service hello
kubectl delete deployment hello
minikube stop
minikube delete
minikube delete removes the whole cluster and frees the disk space. Next, try writing the Deployment as a YAML file and applying it with kubectl apply -f, then explore Kubernetes RBAC and network policies. If you later try a managed cloud cluster, set a budget first and delete the cluster as soon as you finish, because managed control planes and worker nodes charge by the hour.
Practice
Why did a new pod appear after you deleted one?
What does a Service add that pods alone do not?
What command checks which cluster kubectl is talking to?
Key takeaways
- minikube is a free, local, single-node Kubernetes cluster.
- Deployments keep the requested number of pods running.
- Services give pods a stable address.
- Kubernetes constantly reconciles desired and actual state.
- minikube delete removes everything when you finish.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.