DEV Community

Discussion on: Explain Kubernetes to me like I'm Five

Collapse
 
rawkode profile image
David McKay

I can't explain it like you're 5, but I'll do my best to keep things clear.

If you're comfortable with Docker, that helps. Docker is great when you need to run a container on a single host, but when you have more than one host; it doesn't quite work. This is where Kubernetes comes in.

Kubernetes provides the management layer for containers to be distributed across multiple machines and communicate with each other.


Gory details:

Kubernetes has a control plane. This is just technical phrasing. All it means is there's an API to administrate the software. When you ask Kubernetes to run a container for you, you send the request to the control plane; the API server to be specific.

Now because Kubernetes can run on multiple hosts, the API server can't actually run the container. Instead, it stores the "desired" state in etcd. The database of the control plane.

Another part of the control plane is the scheduler. It monitors the desired state. When something new is added it tries to work out which machine can run it. There are many constraints, but CPU or MEM are the common options.

So how does it know which host can run it with the constraints? Well, every host in your cluster also runs a kubelet. This is another part of the control plane. The scheduler asks each kubelet what CPU and MEM it has available. Once a kubelet says a host is available, the scheduler updates the desired state and suggests that the container be run on that host.

Now a controller for the resource type takes over and your desired state becomes actual state.

Anytime the system changes, this loops runs to ensure desired state is met.


Resources

Kubernetes isn't just spinning up containers. It provides resource types for many features beyond the Docker runtime.

Pods: Multiple containers that share namespaces. This is actually the atomic unit you can request

Services: allows containers within the system to communicate with other containers, with load balancing. Services also provide DNS based service discovery (like docker compose)

Deployment: a redundant way to update your containers. Can update N% at a time (perform rolling updates)

There's also RBAC, NetworkPolicies, and a thousand other things.

Hopefully this helps you on your Kubernetes path. Ping me any time with questions

Collapse
 
inidaname profile image
Hassan Sani

Thank you so much for this detailed explanation.