# Kubernetes

> The system that runs and babysits containers across many machines.

- Level: Intermediate
- Topics: Cloud
- URL: https://tidbit.legios.com.ar/kubernetes/
- In Spanish: [Kubernetes](https://tidbit.legios.com.ar/es/kubernetes/)

**Kubernetes** (often shortened to **K8s**) is open source software that runs containers across a group of machines, called a **cluster**. You tell it what you want: "run three copies of this image, give each one 1 GB of memory, expose them on port 80". Kubernetes finds room on the machines, starts the containers, and if one dies or a whole machine fails, it starts a replacement somewhere else without anyone being paged.

That desired state is written in YAML files. A **Pod** is the smallest unit (one container, or a few that must run together); a **Deployment** keeps N copies of a Pod alive and rolls out new versions gradually; a **Service** gives them a stable address so traffic can find them. Change the YAML, apply it, and Kubernetes moves the cluster from the old state to the new one.

Google built it from its internal system (Borg) and open-sourced it in 2014; today it is the default way to run large fleets of containers, and every cloud sells a managed version (Amazon EKS, Google GKE, Azure AKS). The cost is complexity: for one small app it is usually overkill, and simpler options like Amazon ECS and Fargate or a serverless function do the job.

## An analogy

A conductor and an orchestra. The score says what each section should play; the conductor keeps everyone in time, brings in a substitute when a musician gets sick, and the audience only hears the music.

## Keep in mind

- You declare the desired state; Kubernetes keeps reality matching it.
- Pods, Deployments and Services are the three words to learn first.
- It scales by adding machines to the cluster and copies of your Pods.
- Managed offerings (EKS, GKE, AKS) run the control plane for you.

## Go deeper

- [Kubernetes overview (official docs)](https://kubernetes.io/docs/concepts/overview/)
- [What is Kubernetes? (AWS)](https://aws.amazon.com/what-is/kubernetes/)
- [Kubernetes (Wikipedia)](https://en.wikipedia.org/wiki/Kubernetes)

## Related terms

- [Open source](https://tidbit.legios.com.ar/open-source/): Software whose code anyone can read, use, change and share.
- [Container](https://tidbit.legios.com.ar/container/): A sealed box with a program and everything it needs to run anywhere.
- [Port](https://tidbit.legios.com.ar/port/): The numbered door on a computer that says which program a connection is for.
- [Google](https://tidbit.legios.com.ar/google/): The search company that gives most products away and makes its money on ads.
- [Cloud computing](https://tidbit.legios.com.ar/cloud-computing/): Renting computers over the internet instead of buying your own.
- [Amazon EKS](https://tidbit.legios.com.ar/amazon-eks/): Kubernetes with the hard part, the control plane, run by AWS.
- [Microsoft](https://tidbit.legios.com.ar/microsoft/): The company of Windows and Office, now just as much a cloud company with Azure.
- [Amazon ECS and Fargate](https://tidbit.legios.com.ar/amazon-ecs-and-fargate/): AWS runs your containers; with Fargate you never see the servers at all.
