5 Kubernetes Lessons That Almost Broke Me (And Made Me Stronger)
We've all been there. You've just read the Kubernetes docs, watched 10 YouTube tutorials, and you feel invincible.
Then reality hits you like a failed liveness probe at 3am.
Lesson 1: Resource Limits Are Not Optional
I learned this the hard way when our production cluster decided to eat itself because I forgot to set resource limits.
One rogue process later, and suddenly everything is OOMKilled. Fun times!
resources:
requests:
memory: "128Mi"
cpu: "250m"
limits:
memory: "256Mi"
cpu: "500m"
Always set them. Always. I beg you.
Lesson 2: Namespaces Are Your Friend
Before namespaces: "Why is the dev environment affecting production?!"
After namespaces: Sleeping like a baby.
Namespace isolation is one of those things that seems like overkill until the day it saves your job.
Lesson 3: Health Checks Save Lives (and SLAs)
A deployment without proper liveness and readiness probes is just a ticking time bomb.
Your pod might be running, but is it actually working? K8s needs to know!
Lesson 4: Always Have a Rollback Plan
`kubectl rollout undo deployment/my-app` - possibly the most beautiful command in the entire kubectl vocabulary.
Learn it. Love it. Use it at 2am when everything is on fire.
Lesson 5: The Logs Are Your Best Friends
When things go wrong (and they will), `kubectl logs` and `kubectl describe` are your detectives.
Don't panic, just investigate.
Happy clustering! π