Give me 5 minutes and Kubernetes will finally make sense. Kubernetes has a reputation for being the hardest thing in tech. Well, I don't think it's hard. I think it's usually taught backwards. People show you all the parts before they show you the problems that these parts solve. So, let me give you the problems first and the Kubernetes components will explain themselves. And you will immediately grasp the components. So, let's say you have an app and it's running inside a container. Quick definition, container is just your app packed up with everything it needs to run, so it behaves the same everywhere. No matter where you run it. So, that container is running on one server. Now, let's break it on purpose. Problem one, that container crashes at 3:00 a.m. and nobody's awake. So, your app is down for hours. Nobody can reach it. You would want something watching it that notices the crash and restarts it automatically. So, that's the first thing Kubernetes does. Problem two, your application gets popular, great problem to have. So, now one copy of that container cannot handle all the traffic. So, you want 10 copies running with the user requests spread evenly across them. And when traffic drops overnight, you want to scale back down, so you're not paying for running copies that you don't need. So, that's the second thing Kubernetes does. And problem three, you no longer have one server now, you have a whole group of servers, so a cluster of servers, because you need to run multiple replicas, multiple copies of your application and all the services that it needs, databases and so on. And you don't want to manually decide which container runs on which server and which app copy runs on which machine. You just want to say, "Keep 10 healthy copies of my application running somewhere. I don't care which server that's going to be, but spread it evenly, so it's not all on one server." And have something figure out the placement itself. And that's the third thing that Kubernetes does. Now, all the scary terms and concepts in Kubernetes actually mean something. And when you understand what they mean, they become less scary. First of all, your containers run inside pods, which is the smallest unit, usually just for one container. Pods run on nodes, which are the servers. And you never manage pods by hand. Instead, you tell the control plane what you want, like, "I want 10 copies of this app running somewhere on those machines." And that is called the desired state. So, you tell Kubernetes what you desire. And here's the single idea at the heart of how Kubernetes works. Kubernetes constantly compares reality to the state that was desired by you, or you asked for, and fixes any difference automatically. A pod died, so now there are nine instead of 10. So, Kubernetes starts one more. You asked for 10 and there are 12, it removes the two. So, this loop of checking what you want against what's actually running, and closing the gap never stops. It's the internal mechanism of Kubernetes that runs constantly. The technical word is reconciliation, but the idea is simple. You describe the world you want, and Kubernetes does the work automatically to make reality match that, and keep it that way. So, everything else you will ever learn in Kubernetes, services, deployments, all that YAML configuration, is just different ways of telling Kubernetes what you want. That's the whole thing. So, Kubernetes is a manager that keeps the right number of healthy copies of your application running across many machines. So, you never have to babysit them at 3:00 a.m. You declare what you want, the configuration of your application, around your application, and it handles the rest.
Generated algorithmically for Search Engine
Indexing.