Set up a Kubernetes cluster on AWS EKS with eksctl: prerequisites, one-command cluster creation, …
Kubernetes Fundamentals: Pods, Deployments, Services Kubernetes Fundamentals: Pods, Deployments, Services

Summary
Kubernetes has a reputation for being overwhelming, but the core of it rests on three objects: pods, deployments, and services. Learn these Kubernetes fundamentals and most of the rest of the system suddenly makes sense.
This guide is hands-on. You will spin up a real cluster on your laptop with kind, deploy an app the naive way, watch it fail to self-heal, and then fix it the Kubernetes way. By the end you will understand not just what pods, deployments, and services are, but why each one exists.

Set Up a Local Cluster with kind
kind runs a Kubernetes cluster inside Docker containers — perfect for learning the fundamentals without a cloud bill. You need Docker installed, then:
# macOS / Linux (Homebrew)
brew install kind kubectl
# or grab the binary directly
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind
kind create cluster --name learn
kubectl get nodes
If kubectl get nodes shows a node in Ready state, you have a working cluster. Every command in this article runs against it. If you want a refresher on the commands themselves, keep the kubectl cheat sheet open in another tab.
Expand your knowledge with Kubernetes on AWS: EKS Setup with eksctl
Pods: The Smallest Deployable Unit
A pod wraps one or more containers that share a network and storage. You rarely create pods directly, but doing it once shows why you shouldn’t. Create a bare pod:
kubectl run web --image=nginx
kubectl get pods -o wide
Now simulate a failure by deleting it:
kubectl delete pod web
kubectl get pods
The pod is gone. Nothing brings it back. That is the key lesson of this section: a bare pod has no self-healing. If its node crashes or someone deletes it, your app stays down. Pods are the unit of execution, not the unit you manage.
Deepen your understanding in Deploy Jenkins on Amazon EKS: A Practical Tutorial
Deployments: Self-Healing and Scaling
A Deployment is the object you actually use. It manages a ReplicaSet, which guarantees a desired number of identical pods are always running. Write your first manifest:
# web-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:1.27
ports:
- containerPort: 80
Apply it and watch three pods appear:
kubectl apply -f web-deploy.yaml
kubectl get pods -l app=web
Now delete one pod and watch the difference:
kubectl delete pod -l app=web --field-selector=status.phase=Running | head -1
kubectl get pods -l app=web
A replacement pod appears within seconds. The Deployment noticed reality (2 pods) drifted from desired state (3 pods) and reconciled it. That reconciliation loop is the heart of Kubernetes.
graph TD
A[Deployment: replicas=3] --> B[ReplicaSet]
B --> C[Pod 1]
B --> D[Pod 2]
B --> E[Pod 3]
E -. deleted .-> F[ReplicaSet creates a replacement]
F --> G[Pod 3 - new]
Scaling is a one-liner — no manifest edit required for a quick change:
Explore this further in Database Scaling: From 100K to 5M Users in 18 Months
kubectl scale deploy/web --replicas=5
kubectl rollout status deploy/web
Services: A Stable Address for Ephemeral Pods
Your three pods each have their own IP, and those IPs change constantly. A client cannot chase them. A Service solves this by giving the set of pods one stable virtual IP and DNS name, then load-balancing requests across whichever pods currently match its label selector.
# web-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web # routes to every pod labeled app=web
ports:
- port: 80
targetPort: 80
kubectl apply -f web-svc.yaml
kubectl get svc web
kubectl get endpoints web # the pod IPs the Service is routing to
The endpoints output is the magic: it lists the live pod IPs behind the stable Service IP, updated automatically as pods come and go. Test it from your laptop with a port-forward:
Discover related concepts in kubectl Cheat Sheet: 30+ Essential Commands
kubectl port-forward svc/web 8080:80
# now visit http://localhost:8080
kubectl get endpoints web is empty, the Service is routing to nothing — line up the Service selector with the Deployment’s pod labels exactly.How the Three Objects Fit Together
Put the fundamentals in one sentence: a Deployment keeps the right number of pods running, and a Service gives those pods a stable front door. Everything else in Kubernetes — ConfigMaps, Ingress, autoscaling, probes — builds on this spine.
Uncover more details in Create Freeform Feature Flag from S3 Object
Common Beginner Pitfalls
- Creating bare pods. Always use a Deployment so your workload self-heals. Bare pods are for one-off debugging only.
- Mismatched labels and selectors. The Deployment’s
template.metadata.labelsmust match both its ownselector.matchLabelsand the Service’sselector. - Expecting
kubectl editto stick. Editing a live object managed byapplygets reverted on the next deploy. Change the manifest in Git instead. - A pod stuck in CrashLoopBackOff. That means the container starts and dies repeatedly. It deserves its own playbook — see how to fix Kubernetes CrashLoopBackOff.
Where to Go Next
Once the local fundamentals click, the natural next step is a real cloud cluster. Moving from kind to a managed control plane is straightforward with EKS setup on AWS using eksctl. From there, autoscaling, Ingress, and Helm are incremental additions on top of the same pod-deployment-service spine.
What was the concept that finally made Kubernetes click for you — the reconciliation loop, labels, or something else?
Enrich your learning with Sed Gotchas: GNU vs BSD and Safe In-Place Editing
References and Further Reading
- Kubernetes Authors. Kubernetes Concepts. Kubernetes Documentation.
- Kubernetes Authors. Deployments. Kubernetes Documentation.
- Kubernetes Authors. Service. Kubernetes Documentation.
- The kind Authors. kind — Kubernetes IN Docker. kind Documentation.
- Burns, B., Beda, J., Hightower, K., & Evenson, L. (2022). Kubernetes: Up and Running, 3rd Edition. O’Reilly Media.
Similar Articles
Related Content
More from devops
Kubernetes CrashLoopBackOff explained: a step-by-step workflow to diagnose it and fix the six most …
A practical kubectl cheat sheet: 30+ essential commands for pods, deployments, services, logs, and …
You Might Also Like
No related topic suggestions found.
Knowledge Quiz
Test your general knowledge with this quick quiz!
A set of multiple-choice questions to test your knowledge.
Take as much time as you need.
Your score will be shown at the end.
Question 1 of 5
Quiz Complete!
Your score: 0 out of 5
Loading next question...

