Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Introduction  ›  Lesson

Why Use Kubernetes?

Why use Kubernetes? 12 minKubernetes automates self-healing, scaling, rolling updates, service discovery, load balancing and scheduling, which pays off only when you need several of them.

Why Use Kubernetes?

The notes app has grown. It needs three copies of the web server, updates twice a week without downtime, and a database that must survive a crashed machine. You could write scripts for each of these. Kubernetes exists so that you do not have to.

The rule

Kubernetes turns chores you would script into promises the cluster keeps.

Each chore below is something a team would otherwise do by hand or with custom scripts. In Kubernetes it becomes one line of configuration:

Chore What Kubernetes gives you
Restart crashed apps Self-healing: failed containers are restarted, lost copies replaced
Add copies at busy times Scaling: change replicas, or let an autoscaler do it
Ship a new version safely Rolling updates that swap copies gradually, with undo
Find the other services Service discovery: a stable name like notes-db
Spread traffic Load balancing across healthy copies
Fit apps onto machines Scheduling that packs work onto nodes with room

Scaling our web tier is a single command:

kubectl scale deployment notes-web --replicas=5

The same manifests also run on a laptop, in a company data centre, or on any major cloud, so you are less tied to one provider.

Kubernetes is not free, though. It has many moving parts, a vocabulary to learn, and a cluster to keep healthy. A single small app with little traffic on one server may be happier with something simpler.

The shortcut

Count the chores. If you would otherwise write scripts for several of them, Kubernetes pays for itself. If you need none of them, it is overhead.

Should the notes app move to Kubernetes?Step 1 of 4
  1. List the needs

    Three web copies, updates without downtime, restart on crash, a database that keeps its data.

The trap is adopting Kubernetes because it is popular. A weekend project with one container and no uptime promise gains little and pays the full learning cost.

Drills

Answer fast — trust the rule.

quick drill

A notes-web container crashes. Which Kubernetes feature brings it back?

quick drill

Which command raises the notes-web Deployment to five copies?

quick drill

The web tier needs to reach the database without hard-coding an IP address. Which feature helps?

quick drill

Which situation gains the least from Kubernetes?

Remember

  • Kubernetes turns chores you would script into promises the cluster keeps.
  • Count the chores: several needed means it pays; none means overhead.
  • Trap: adopting it for fashion when one server would do.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainIs it worth it here?

A friend runs a small recipe website: one container, one server, a few visitors a day. They ask whether to move it to Kubernetes. Give a recommendation and justify it by naming which Kubernetes features they would or would not use.