What are Pods, Deployments and Services in Kubernetes?
BeginnerConceptContainers & Kubernetes basics
Answer
In one line: A Pod runs your container(s), a Deployment manages a set of identical Pods and their updates, and a Service gives those Pods a stable address and load balances traffic to them.
Pod
- The smallest unit you deploy in Kubernetes.
- Usually one main container (sometimes with helper "sidecar" containers) sharing network and storage.
- Pods are temporary — they get a new IP when recreated, and you rarely create them directly.
Deployment
- Describes the desired state: which image, how many replicas, how to update.
- Creates a ReplicaSet, which keeps the right number of pods running.
- Handles rolling updates and rollbacks:
kubectl set image deployment/orders orders=myrepo/orders:1.4.3 kubectl rollout undo deployment/orders
Service
- Pods come and go, so their IPs change. A Service gives them a stable name and IP and load balances across all matching pods using labels.
- Types:
- ClusterIP (default) — reachable only inside the cluster (
http://orders:8080). - NodePort — opens a port on every node.
- LoadBalancer — creates a cloud load balancer for external traffic.
- ExternalName — a DNS alias to an outside service.
- ClusterIP (default) — reachable only inside the cluster (
How they connect (labels):
# Deployment pod template
labels: { app: orders }
---
apiVersion: v1
kind: Service
metadata: { name: orders }
spec:
selector: { app: orders } # sends traffic to pods with this label
ports: [{ port: 80, targetPort: 8080 }]
Related objects you'll mention next: Ingress/Gateway (HTTP routing from outside), ConfigMap and Secret (configuration), StatefulSet (databases and stateful apps), DaemonSet (one pod per node, like log agents), Job/CronJob (batch tasks).
Tip for interviews: explain that Services find pods through label selectors — it's the glue between these objects.
More on Containers & Kubernetes basics
What is the difference between a Docker image and a container?BeginnerWhat makes a good Dockerfile? Give some best practices.BeginnerWhat is Kubernetes, and why do we need it?BeginnerExplain the Kubernetes architecture in simple terms.BeginnerWhat are liveness, readiness and startup probes?BeginnerWhat are resource requests and limits in Kubernetes?Beginner