Production Best Practices
Harry
· 11 Sep 2026
· 9 views
Before You Go Live
- Set resource requests and limits on every container.
- Add liveness and readiness probes so Kubernetes restarts or reroutes broken pods.
- Encrypt Secrets at rest and rotate them regularly.
- Back up etcd and any persistent data; test the restore.
Probes Example
containers:
- name: app
image: myapp:1.2
livenessProbe:
httpGet:
path: /healthz
port: 8080
readinessProbe:
httpGet:
path: /readyz
port: 8080readiness gates traffic while a pod is still starting; liveness restarts a pod that hangs forever.
Declarative Everything
Keep every manifest in Git. Apply with kubectl apply or better, a GitOps tool (Argo CD, Flux) that syncs the cluster to your repo.
Versioning and Upgrades
- Pin container image tags; never rely on
latest. - Use backups and practice restores for etcd and databases.
- Upgrade components (Kubernetes, cluster add-ons, Helm charts) gradually and verify each step.
Security Essentials
- Run containers as non-root with read-only filesystems where possible.
- Use NetworkPolicies to restrict pod-to-pod traffic.
- Regularly run vulnerability scans on your images.
Key Points
- Probes + resource limits make workloads self-healing and safe.
- GitOps keeps the cluster reproducible and auditable.
- Security is a loop: images, access, network policies and secrets all need attention.