The Problem with Most Kubernetes Tutorials
They start with clusters. They explain control planes, etcd, API servers. By the time they get to deploying something, you've already closed the tab.
You don't need to understand how Kubernetes works internally to use it well. You need to understand the four or five concepts that map directly to your daily work.
This post covers exactly those concepts, nothing more.
Concept 1: A Pod Is the Smallest Unit
A Pod is one or more containers that run together on the same node and share network and storage. In practice, most Pods contain a single container.
apiVersion: v1
kind: Pod
metadata:
name: my-app
spec:
containers:
- name: app
image: my-app:1.0.0
ports:
- containerPort: 3000
You almost never create Pods directly. You create Deployments that manage Pods for you.
Concept 2: A Deployment Manages Your Pods
A Deployment says: "I want 3 replicas of this Pod, always." Kubernetes figures out how to make that true and keep it true.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app
image: my-app:1.0.0
ports:
- containerPort: 3000
When you push a new image, you update image: my-app:2.0.0 and Kubernetes rolls it out without downtime.
Concept 3: A Service Gives Your App a Stable Address
Pods come and go. Their IP addresses change. A Service gives your Deployment a stable DNS name that other services can use.
apiVersion: v1
kind: Service
metadata:
name: my-app
spec:
selector:
app: my-app
ports:
- port: 80
targetPort: 3000
Now other services in the cluster can reach your app at http://my-app.
Concept 4: ConfigMaps and Secrets for Configuration
Never put configuration in your container image. Use ConfigMaps for non-sensitive config and Secrets for passwords and API keys.
apiVersion: v1
kind: ConfigMap
metadata:
name: my-app-config
data:
DATABASE_HOST: postgres-service
LOG_LEVEL: info
Reference them in your Deployment:
envFrom:
- configMapRef:
name: my-app-config
- secretRef:
name: my-app-secrets
Concept 5: Resource Requests and Limits
Tell Kubernetes how much CPU and memory your app needs. This lets the scheduler make good decisions and prevents one misbehaving app from starving others.
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
100m means 0.1 CPU cores. Start conservative and tune based on actual usage.
The Workflow That Matters
# Build and push your image
docker build -t my-app:2.0.0 .
docker push my-app:2.0.0
# Update your deployment
kubectl set image deployment/my-app app=my-app:2.0.0
# Watch the rollout
kubectl rollout status deployment/my-app
# Something wrong? Roll back instantly
kubectl rollout undo deployment/my-app
That's it. That's 90% of your daily Kubernetes workflow.
The rest (Ingress, HPA, PersistentVolumes) you can learn as you need it. But if you understand Pods, Deployments, Services, ConfigMaps, and resource limits, you can ship and maintain a production application on Kubernetes today.