Kubernetes Fundamentals
Kubernetes runs containers across many machines and keeps them in the state you describe — restarting, scaling and replacing them automatically.
On this page · 5 min · Intermediate
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Intermediate
- Updated
- Oct 29, 2026
Related tutorials
Learning objectives#
- Describe clusters, nodes and pods
- Use kubectl to inspect a cluster
- Understand desired state
- Decide when Kubernetes is worth it
Explanation#
A cluster has a control plane (decides) and worker nodes (run containers). The smallest unit is a pod — one or more containers sharing network and storage.
You declare desired state in YAML (“3 replicas of shop-api:1.4.0”); controllers keep reality matching it.
kubectl is the command-line tool. Namespaces separate teams or environments in one cluster.
For local practice use kind, minikube or Docker Desktop’s Kubernetes. In the cloud: AKS, EKS, GKE.
Code example: Exploring a cluster with kubectl#
kind create cluster --name learn # local cluster in Docker
kubectl get nodes
kubectl create namespace shop
kubectl run hello --image=nginx --namespace shop
kubectl get pods -n shop
kubectl describe pod hello -n shop | tail -n 5
kubectl delete pod hello -n shop
NAME STATUS ROLES AGE VERSION learn-control-plane Ready control-plane 40s v1.3x.x NAME READY STATUS RESTARTS AGE hello 1/1 Running 0 8s
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- kind runs a whole cluster inside Docker.
- A namespace groups the app’s resources.
- kubectl run creates a single pod (fine for learning, not production).
- describe shows events — the first place to look when a pod fails.
Real-world use case#
Platforms running dozens of services that need self-healing, rolling updates and autoscaling.
Common mistakes#
Managed services like App Service, Container Apps or ECS Fargate are simpler.
Bare pods are not recreated when they fail. Use Deployments.
Best practices#
- Learn locally with kind or minikube
- Use namespaces
- Declare everything in YAML in Git
- Use managed control planes in the cloud
Remember this#
Cluster → nodes → pods → containers.
You declare desired state; Kubernetes maintains it.
kubectl get / describe / logs.
Practice exercise#
Your task: Show the logs of the pod hello in namespace shop.
Show solution
kubectl logs hello -n shop
Mini quiz#
What is the smallest deployable unit in Kubernetes?
Want more? Practise all DevOps MCQs · DevOps interview questions
My notes#
Saved in this browser.