Understanding Kubernetes Pods, Deployments and Services
Three core Kubernetes objects do most of the work. Understanding them makes the rest of Kubernetes click.
Pods
A Pod is the smallest deployable unit — one or more containers that share networking and storage. You rarely create Pods directly.
Deployments
A Deployment manages a set of identical Pods, handling rollouts, scaling and self-healing.
kubectl create deployment web --image=nginx
kubectl scale deployment web --replicas=3
kubectl get podsServices
A Service gives a stable network endpoint to a set of Pods, load-balancing traffic between them.
kubectl expose deployment web --port=80 --type=NodePort
kubectl get servicesUseful inspection commands
kubectl describe deployment web
kubectl logs <pod-name>
kubectl delete deployment webDefine these objects declaratively in YAML and apply them with kubectl apply -f file.yaml.