Free tech learning for everyone, from basics to pro

Cloud LabsLabsIntermediate

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.
Lab layersYour laptopDocker or a hypervisorminikube nodeone-node clusterDeploymentdesired replicasPodsnginx containersServiceNodePort access
Figure 1. minikube runs a one-node Kubernetes cluster on your laptop; you add a Deployment, its Pods and a Service on top.

Steps

  1. Start the cluster with the Docker driver and check the node is Ready.
  2. Create a Deployment called hello using the nginx image.
  3. Scale it to three replicas and watch the pods appear.
  4. Expose it as a NodePort Service and open the URL minikube gives you.
  5. Delete one pod and watch a replacement start.
  6. 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
Kubernetes reconciliation loopDesired stateyou declare itObservecontroller watchesComparefind differencesActcreate or delete pods
Figure 2. Controllers keep comparing what you asked for with what is running and fix any gap, which is why deleted pods come back.

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 pod shows the exact error.
  • minikube will not start: make sure Docker is running and you gave enough memory; minikube logs helps.
  • Service URL does not load: on Docker Desktop the minikube service command 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 say minikube. 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?
The Deployment declares three replicas; its controller noticed only two and created a replacement.
What does a Service add that pods alone do not?
A stable name and address that load-balances across the changing set of pods behind it.
What command checks which cluster kubectl is talking to?
kubectl config current-context.

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.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

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.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.