AI Hints
Home›Kubernetes Tutorial›Bonus: Managed Kubernetes and Best Practices
Kubernetes · Lesson 86 of 86

Best Practices

The checklist for real clusters.

⏱ 2 min read▶ Video at 3:15:28🎓 Free
Watch this lesson in the Kubernetes courseWatch on YouTube ↗Full Kubernetes course

We end the bonus clips with a checklist. It brings together the best practices of this course, in one place. Use it when you review your own clusters, or when you prepare for production. It is long, but each line comes from a lesson you have already seen. Pause on each screen, and tick the boxes.

Best Practices
From the video: Best Practices
  • Reliability
  • Security
  • Operations

Reliability checklist

First, reliability. At least two replicas for everything important, spread across nodes, and zones. Resource requests, and limits, on every container. Readiness, and liveness probes, with sensible timing. Rolling updates, with max unavailable zero, for services. Pod disruption budgets, for safe maintenance. Graceful shutdown, handling the term signal. And autoscaling, based on real load. These seven items remove most outages, before they happen.

Replicas spread outnodes and zones
Requests and limitsevery container
Probes and graceful shutdownready and stoppable
Rolling updates and PDBssafe changes and maintenance
Autoscalingfollow the load

Security checklist

Second, security. Run containers as non root, with read only file systems, and no extra capabilities. Use role based access control, with least privilege, and a separate service account per application. Keep secrets out of Git, and encrypt them at rest. Apply network policies, with a default deny. Enforce pod security standards, and admission policies. Pull images from trusted registries, scan them, and never use the latest tag. And keep Kubernetes, and its nodes, upgraded.

Hardened podsnon-root, read-only, no capabilities
RBAC least privilegeone service account per app
Secrets protectednot in Git, encrypted
Network and admission policydefault deny, enforced rules
Trusted, scanned imagesnever latest

Operations checklist

Third, operations. Everything as code, in Git, with changes reviewed, and delivered by a Git ops tool. Monitoring of metrics, logs, and events, with alerts on user visible symptoms, and a runbook for each. Regular backups of et see dee, and of volumes, with a rehearsed restore. Namespaces per team, with quotas, and labels for cost. Upgrades on a schedule, one minor version at a time. And a weekly health review, of dashboards, alerts, cost, and incidents. Boring operations are the goal.

Git and GitOpsreviewed, automated delivery
Observabilitymetrics, logs, events, alerts
Backups, rehearsedetcd and volumes
Namespaces, quotas, labelsownership and cost
Upgrade and review rhythmscheduled, weekly

Common anti-patterns

Finally, a few anti patterns to avoid. Running a single replica, of something important. Using the latest tag, so nobody knows what is running. Putting secrets in images, or in Git. Giving every pod cluster admin rights. Editing live objects by hand, without recording it. Skipping requests and limits, so one pod can starve the node. And running everything in the default namespace. Each of these has caused real outages, and real breaches. Now you know the alternative, for every one.

Avoid

  • One replica of something important
  • The latest tag
  • Secrets in images or Git
  • Cluster-admin for every pod

Instead

  • Two or more, spread across nodes
  • Fixed, versioned tags
  • A secret store, encrypted
  • Least privilege RBAC

Summary

Excellent. You now have the full checklist, reliability, security, and operations, and the anti patterns to avoid. Keep it close, review your clusters against it, and keep practising. And now, a short quiz, to test what you remember.

Key takeaways
  • Reliability: replicas, probes, PDBs
  • Security: least privilege, policies
  • Operations: Git, backups, reviews
Next up: Quiz Time — test your knowledge