The Coffee Shop

Suppose your shop makes the best coffee in town.

But as you become more and more popular, you can’t keep up with the demand.

Automate the process with a Coffee Pod

To cope with your increasing demand, you decided to automate the coffee-making process.

You get a self-contained automated machine to make coffee for you. It has everything required to make coffee preinstalled.

In the Kubernetes world, we’ll call this self-contained, isolated thing a ‘Pod’. (We’ll get into Pods vs Containers later, we’ll call it pod for now for simplicity)

More demand, more coffee pods

The coffee pod is being pushed to its limits.

It was going well until you realized you just grew way too popular that you can barely keep up with the demand. Long queues in front of the store, the coffee pod running all day making coffee. Result - unsatisfied customer and exhausted you.

It’s time to get more coffee pods.

Managing all those pods is a bummer

You did get 3 more pods. But managing them is challenging.

You have to -

  • make sure all pods are up and running.
  • when a customer orders a coffee, send that request to an appropriate pod
  • re-fill the pods with the ingredients like coffee beans, sugar etc.

Also, you found that not all 4 pods are being utilized all the time, wasting power. But during peak hours, the demand was so high, even 4 pods weren’t enough.

It was getting too much for you to manage at that point. Frustrated and almost ready to give up, you thought all hope was lost.

Kube - the savior appears

But suddenly a mysterious figure known only as ‘Kube’ appears, like a beacon of light in the darkness, to guide you to a better way.

Kube is like a wizard who took care of all your problems. What couldn’t he do? Not much apparently. He -

  • makes sure the proper number of coffee pods is always running
  • Distributes pods to run on different power sources(aka Nodes) to properly utilize them.
  • Constantly monitors customer demand.
    • when demand is very high, automatically turns on extra coffee pods.
    • during low demand, shuts down some of those pods to save power.
  • Kube, being a wizard, magically knows about any malfunctioning pods (via Liveliness Probe), and immediately replaces them with a shiny new one.
  • If a power source goes down, it takes down all coffee pods connected to it as well.
    • Kube immediately takes action by re-plugging them into the available power sources, without any manual intervention.
  • Kube even made you a device called ‘Service’ that takes coffee orders on your behalf, how cool is that?
    • ‘Service’ then sends that coffee request to any of the running pods based on how busy they are.
  • Kube also created something called ‘Volume’ where he puts all the ingredients like coffee beans, sugar etc.
    • The pods magically share them from the ‘Volume’ whenever they want.
  • Kube even made you something called ‘Secret’ where you can securely put your locker ‘keys

One day you decided to get another pod to clean your shop every day.

Kube, being a wizard, attached something called a CronJob on that cleaning pod and guess what. That cleaning pod is now automatically cleaning the shop everyday at a certain time.

In this way, Kube makes your life easier just how Kubernetes makes the lives of developers and sys admins easier using its different magic spells called Kubernetes Objects.

Stay tuned for more, where we’ll dive deeper into all the terms used here(Pod, Service, Volume etc.) as analogies for Kubernetes.

I tweet about these topics and anything I’m exploring on a regular basis. Follow me on twitter