A visual mental model for how Kubernetes takes desired state (YAML) and turns it into running Pods, networking, and self-healing workloads across nodes.
You describe the cluster’s desired state. Kubernetes continuously reconciles it.
# Typical demo apply order
kubectl apply -f mongo-config.yaml
kubectl apply -f mongo-secret.yaml
kubectl apply -f mongo.yaml
kubectl apply -f webapp.yml
Key idea
K8s is declarative: you say is, it works to keep it should.
The “brain” that stores state, decides placements, and drives reconciliation.
Mental model
API Server is the front door. etcd is memory. Controllers + scheduler are the decision engines.
Where workloads actually run.
Key idea
Kubernetes makes many machines feel like one cluster computer.
Pods can be recreated; their IPs change.
Treat Pods as cattle, not pets.
A stable endpoint + load balancer to a set of Pods.
Traffic: service → matching Pods (labels).
Routes external HTTP(S) to Services (often via an Ingress Controller).
Browser → Ingress → Service → Pods
MongoDB + WebApp, configured via ConfigMap/Secret and exposed externally for local testing.
This is the exact “MongoDB + webapp” Minikube demo layout.
kubectl apply -f mongo-config.yaml
kubectl apply -f mongo-secret.yaml
kubectl apply -f mongo.yaml
kubectl apply -f webapp.yml
Reason: Deployments reference ConfigMap/Secret; they must exist first.
These must exist before Pods start, because Deployments reference them.
Most commonly injected as environment variables via valueFrom.
Create/update desired state.
See what exists and why.
Debug runtime behavior.
Reach your Service from your laptop.