Whom is this story for?
- you heard at least once of Kubernetes, but never understood, how it works
- too much of IT drives you mad
- you want to get a general idea about Kubernetes
- you have (almost) no difficulties to read a story that is a little longer than a regular post in the social media
Start your career as a city mayor
Imagine, you are promoted to the city mayor on a planet in a galaxy far, far away. We call this city Kubercity. Your main duty is to organize work of many well motivated clones that are born in your city and ready to start.
Kubercity is a Kubernetes cluster and you as a city mayor are a cloud engineer
A clone is an independent workman that is trained to execute one particular function, e.g. to translate words from language A to language B. Sometimes it needs assistance from other clones to do the job properly. In such case it is wise to join clones in a family and settle them together in a common place.
So, you build small houses for your clones and put everyone in a single family or in a family of two and sometimes even of three.
Such houses are called pods and clones are docker containers
Clones are always doing their job at home but need to communicate with each other. How they do it? Each house has a mailbox that hangs at the door. If they find in the mailbox a new piece of work to do, clones do their job and send the result to another mailbox. So, every house of Kubercity has an address and is connected to the sophisticated transport network.
This transport network is not available outside of Kubercity and is called cluster network. All addresses are private and known only within Kubercity.
Kubercity is founded and it starts growing. You as a city mayor have to master this challenge and need more structure.
Landscape of Kubercity
The planet where Kubercity is built on is not like our Earth. The entire surface of the planet is completely covered by water. The mysterious ocean is alive with aggressive monsters that like to damage and destroy your clones.
However, alien engineers have been developed a technology to raise within 5 till 15 minutes impenetrable islands with high cliffs. Kubercity is set upon such islands which can be of different sizes.
As you build new houses, they take more and more place. Some houses are smaller, others — larger. And it does matter, because you have to pay to the alien government for built and occupied islands. What is more, you cannot just claim new land for one or two houses. You claim an entire island at once.
Island of Kubercity is a virtual machine — a worker node in Kubernetes
If you claim a new island and join it to Kubercity by building bridges, your clones relocate their houses immediately in there. Clones don’t like to live in a crowdy neighbourhood and are often sent to more empty areas. Actually, it is a very useful immigration policy, because it makes Kubercity more stable and you as city mayor are more successful. You will see it later, if we speak about diseases and natural disasters that may happen in Kubercity.
However, you are able to manage the migration of clones in a way you like. We speak about it later too, when we take an overview over how the bureaucratic machine of Kubercity works — a very crucial part of the Kubernetes concept.
There is another one strange thing: even though clones look for emptier spaces, they are not aware which island they live on. They are even not aware that there are islands! Clones are just sent to somewhere with more room and they stay there.
This describe the next concept of Kubernetes: docker containers are deployed in the cluster without knowing the underlaying architecture. In their world they run in a cluster, not on virtual machines.
Companies of Kubercity
As you become a successful city mayor, you receive even more work orders and new clones to execute them. Kubercity has following missions now:
- convert images into text
- translate the text into a different language
- learn clones to speak this language
Your duty is to organize clones while clones complete their countless tasks. Since you want to have a good control over these tasks, you found different companies: each company is in charge of one particular mission. That makes three companies that you assign clones to.
Furthermore, you decide to paint houses of every company into a different color: red, blue or green. The thing is that clones of the same company do not necessarily live on the same island. Islands of Kubercity become very colourful.
These companies is a concept of namespacing in Kubernetes. Software engineers often create namespaces and assign the docker containers to them, so that a huge Kubernetes cluster becomes more manageable and better structured.
The good thing is that you can put the companies under several restrictions: how much land are they allowed to take, what are clones allowed to do within the company, which policies for the housebuilding are in place for this company and so on.
Seaport of Kubercity
How about visitors of Kubercity? We mentioned before that islands are inaccessible from outside, but what would be the point of a city, if nobody could visit it?
You as a city mayor decide to build a seaport with a checkpoint where every visitor must identify him or herself. At the entrance there is a large sign with the name of the seaport, so that visiting ships can find Kubercity in the huge ocean of the planet: www.kubercity.planet
If a visitor arrives, he or she must have a valid identification as well as the name of a mission that has to be completed by clones of Kubercity. Normally, the full name of a mission sounds like www.kubercity.planet/translate or www.kubercity.planet/convert-image. The border police checks for the identification and, if everything is fine, they schedule the mission to the house address of an appropriate clone. This address is known only within Kubercity and is hidden to the visitors.
Kubercity’s seaport is so-called ingress network of Kubernetes. It converts the public URL into the internal address of a pod and routes the traffic from the public internet into the Kubernetes cluster.
It might happen that all clones are already busy with executing missions and visitors have to wait a little longer for a response. This might result into a traffic jam at the seaport, and the border police could even send visitors back without processing their missions at all. Such situation decreases your reputation as a city mayor and that is definitely not what you want. In that case you need more clones that can master the mission, and Kubercity provides a very sophisticated technology to create more clones in a short period of time, if needed.
Kubernetes can scale its own capacity accordingly to the load created by the users or other client services. However, this feature requires advanced skills from cloud engineers to benefit from it properly.
That is all as a basic concept of how Kubernetes works. However, I would recommend reading the next articles about how updates and self-healing work as well as about the bureaucratic machine of Kubercity. At the end you should better understand, why Kubernetes might boost your business into a new age.