Author: Shi Yifeng
Source: Hang Seng Light Cloud Community
This article translates the content of the illustrator version of the official English, and the illustrator version guide is vivid and helps to better understand k8s.
English original text--The Illustrated Children's Guide to Kubernetes
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
One day, my daughter walked into the study and asked me, "Dear dad, what is Kubernetes? 』
I replied to her: "Kubernetes is an open source Docker container orchestration system, which can schedule nodes in computing clusters, dynamically manage the above jobs, and ensure that they run in the state expected by users. By using the concepts of "labels" and "pods", Kubernetes groups applications into logical units for easy management and service discovery. 』
The daughter is even more puzzled... so there is this story
A long, long time ago, there was an application called Phippy. She is a simple application written in PHP with only one page.
She lives in a host that needs to share an environment with other horrible apps that she doesn't know and doesn't want to deal with.
She wished she could have an environment of her own: just herself and the web server she could call home.
Every application has an environment on which it runs. For PHP applications, this environment might include the Web server, a readable file system, and the PHP engine itself.
One day, a kind whale appeared. He suggested that little Phippy might be happier living in a container. So the application Phippy was migrated to the container. This container is great, but...it's kind of like a luxurious living room floating in the middle of the ocean.
Containers provide an isolated environment in which applications can run. But these isolated containers often need to be managed and connected to the outside world.
For isolated containers, shared file systems, network communication, scheduling, load balancing, and distribution are all challenges to face.
Just when Phippy even began to despair, a captain of a giant ship appeared on the horizon. The ship is made up of dozens of rafts tied together, but from the outside it looks like a giant ship.
"Hello, PHP application friend. I'm Captain Kube," said the wise old captain.
"Kubernetes" means captain in Greek. We can get the phrases Cybernetic and Gubernatorial from this word. The Kubernetes project focuses on building a robust platform for running thousands of containers in production.
"I'm Phippy," the applet said.
"Nice to meet you," the captain said, putting a name tag on her.
Kubernetes uses labels as "name tags" to identify things. It can query based on these tags. Tags are open-ended: you can use them to represent character, stability, or other important attributes.
The captain suggested that the app move her container to one of the cabins on the ship. Phippy happily moved her container to the cabin of Captain Kube's gigantic ship. Phippy feels like home here.
In Kubernetes, a Pod represents a runnable unit of work. Typically, you would run a container in a Pod.
But for some cases where containers are tightly coupled, you can choose to run multiple containers in the same Pod.
Kubernetes is responsible for connecting your Pods to the network and the rest of the Kubernetes environment.
Phippy has some unusual interests, she loves genetics and sheep. So she asked the captain, "If I want to clone myself, can I clone as many times as I want?"
"It's easy," said the captain. The captain introduced Phippy to the Replication Controller.
Replication Controller provides a way to manage any number of Pods. A Replication Controller contains a Pod template that can be replicated any number of times.
Through the Replication Controller, Kubernetes will manage the lifecycle of the Pod, including scaling, rolling updates, and monitoring.
For countless days and nights, the little app had a great time with her replica in her cabin. But being with yourself is not as good as it says...even if you have N clones of yourself.
Captain Kube smiled kindly. "I happen to have one."
He just spoke, opening a tunnel between Phippy's Replication Controller and the rest of the ship. Captain Kube smiled and said, "Even if your replicas come and go, this tunnel will always stay here, you can find other Pods through it, and other Pods can find you!"
Services tell the rest of the Kubernetes environment (including other Pods and Replication Controllers) what services are included in your application, and as Pods come and go, the IP addresses and ports of the services remain the same.
Other applications can find your service through Kurbenetes Service Discovery.
Thanks to these services, Phippy began to explore other parts of the ship. It wasn't long before Phippy met Goldie. They became best friends.
One day, Goldie did an unusual thing. She gave Phippy a present. Phippy glanced at the gift and tears of sadness welled up in his eyes.
"Why are you so sad?" Goldie asked.
"I love this gift, but I don't have a place to put it!" Phippy sobbed.
But Goldie knew what to do. "Why not put it in a roll?"
A volume represents a location where a container can access and store information. To applications, the volume appears as part of the local file system. But volumes can be backed by local storage, Ceph, Gluster, persistent block storage, and other storage backends.
Phippy loves living on Captain Kube's ship, and she enjoys the company of new friends (Goldie and every clone are equally delightful). But as she thinks back to her days at the dreaded host, she wonders if she too can have a little privacy of her own.
"That sounds like what you need," Captain Kube said. "It's a namespace."
Namespaces are the grouping mechanism inside Kubernetes. Services, Pods, Replication Controllers, and Volumes can easily collaborate within namespaces, but namespaces provide a degree of isolation from the rest of the cluster.
Phippy sails the sea with her new friend on Captain Kube's giant ship. She has had many great adventures, but most importantly, Phippy has found a home.
So Phippy lived happily ever after.