Kubernetes Essentials
Source: Dev.to
Pods
Definition: Smallest deployable unit in Kubernetes; can run one or more containers.
Commands
kubectl get pods # List all pods
kubectl describe pod # Detailed info
kubectl logs # View container logs
Deployments
Purpose: Ensure your application runs with the desired number of replicas. Handles updates and rollbacks automatically.
Commands
kubectl create deployment --image=
kubectl get deployments
kubectl scale deployment --replicas=N
Services
Purpose: Expose pods to internal or external traffic.
Types
- ClusterIP – internal only (default)
- NodePort – accessible via node IP
- LoadBalancer – external access via cloud load balancer
Commands
kubectl expose deployment --type=NodePort --port=80
kubectl get svc
Common Commands
kubectl get all # List all resources in the cluster
kubectl delete pod # Remove a pod
kubectl apply -f # Apply configuration files
Troubleshooting
kubectl describe pod # Check events, errors, or misconfigurations
kubectl logs # Inspect application logs
kubectl get nodes # Check node health and availability
Tip: Start by inspecting pods and their logs when troubleshooting, then check deployments and services. Clear visibility into resources makes Kubernetes management easier.