CareerByteCode
ByteBlogby CareerByteCode

Kubernetes Basics Through a Restaurant Kitchen

🟢 Beginner

Have you ever opened a Kubernetes tutorial, seen words like Pod, Node, Control Plane, ReplicaSet and DaemonSet, and wondered how they all connect?

Kubernetes Basics Through a Restaurant Kitchen

✍️ Translate this blog into Hindi, Tamil or Telugu


Learning Kubernetes basics can feel confusing at first, especially when you come across terms like Pods, Nodes, Deployments and Services.

Instead of trying to understand all these terms separately, let's connect them to something familiar: a restaurant kitchen.

Imagine a restaurant during its busy lunch hours. Customers place orders, the manager assigns work, cooks prepare dishes at different workstations, and the team makes sure every order reaches the right customer.

🛍️✨ From the author · ByteStore1:1 DevOps Project & Learning Discussionโ‚น500View offer →

Now imagine managing all these activities without a proper system. It would quickly become difficult to keep everything organized.

Kubernetes works in a similar way for applications. It helps manage containers, run workloads across machines, and maintain applications in the desired state.

Let's step into the restaurant kitchen and understand how Kubernetes works, one concept at a time.

1. One cook and one stove: Understanding containers

Imagine you prepare a dish at home. You know exactly which ingredients, utensils and cooking settings you used. But when someone tries to prepare the same dish in another kitchen, it might not turn out the same.

Software developers face a similar problem:

"It works on my machine, but it doesn't work on yours."

A container helps solve this problem.

A container packages an application along with the libraries, dependencies and runtime it needs. This makes the application more consistent when it runs in different environments.

Think of a container as a prepared cooking station with the ingredients and equipment needed for one particular dish.

Container vs Virtual Machine

A Virtual Machine (VM) and a container both provide isolated environments, but they work differently.

Virtual MachineContainer
Runs its own guest operating systemShares the host operating system kernel
Includes a full operating system environmentUsually contains the application and its dependencies
Generally requires more resourcesGenerally uses fewer resources
Often takes longer to startUsually starts faster

A simple analogy:

  • A VM is like a separate house with its own facilities.

  • A container is like a room in a shared building, using some of the building's common infrastructure.

Docker is a popular platform used to build and run containers. However, running a few containers on one machine is different from managing hundreds of containers across multiple machines.

That is where Kubernetes becomes useful.

2. The serving tray: Understanding Pods

A restaurant does not always serve every dish separately. Sometimes a main dish and its accompanying items are placed together on one tray.

Kubernetes uses a similar concept called a Pod.

A Pod is the smallest deployable unit in Kubernetes. It contains one or more containers that need to run together.

Most Pods contain one application container. However, some Pods contain multiple containers that work closely together.

For example:

  • One container runs a web application.

  • Another container collects its logs or supports it with another function.

Containers inside the same Pod share the same network namespace, including the Pod's IP address and port space. They can also share storage when volumes are configured for them.

Think of it this way:

  • Container = the application.

  • Pod = the tray carrying one or more containers.

Are Pods permanent?

No. Pods are designed to be replaceable.

If a Pod managed by a Deployment fails, Kubernetes can create a replacement Pod to maintain the desired number of replicas. The replacement is a new Pod, not a repaired copy of the old one.

This is an important Kubernetes concept: instead of depending on one particular Pod, we describe how many copies of our application should be running.

3. The kitchen stations: Understanding Nodes

A serving tray needs a place to sit. In Kubernetes, that place is called a Node.

A Node is a physical or virtual machine that runs Kubernetes workloads.

A Kubernetes cluster can contain one or more Nodes.

Nodes are commonly described as:

  • Control Plane Nodes: Run the components that manage the cluster.

  • Worker Nodes: Run application workloads.

A worker Node has important components:

ComponentWhat it does
kubeletCommunicates with the Control Plane and ensures assigned Pods are running
Container runtimeRuns containers, for example containerd or CRI-O
kube-proxyImplements Service networking rules in clusters that use it

A container runtime is the software responsible for running containers. Kubernetes communicates with compatible runtimes through the Container Runtime Interface (CRI).

containerd and CRI-O are examples of container runtimes.

One important detail: kube-proxy is common in Kubernetes clusters, but some networking implementations provide equivalent Service functionality without it.

Remember: Worker Nodes do the work of running application Pods.

4. The kitchen manager: Understanding the Control Plane

Imagine a restaurant with several kitchen stations. Someone must receive orders, decide where the work should happen, keep records and check whether everything is running as expected.

That is the role of the Kubernetes Control Plane.

The Control Plane manages the overall state of the cluster.

It has four important components:

ComponentRestaurant analogyResponsibility
API ServerFront deskReceives and processes Kubernetes API requests
etcdOrder bookStores cluster configuration and state data
SchedulerOrder coordinatorSelects a suitable Node for newly created Pods
Controller ManagerSupervisorRuns controllers that work to maintain the desired state

Let's understand them one by one.

API Server

The API Server is the entry point for Kubernetes API requests. When you use kubectl, your request is sent to the API Server.

etcd

etcd is the key-value data store used by Kubernetes to store important cluster information.

Think of it as the restaurant's order book, where the manager keeps track of what has been requested and recorded.

Scheduler

The Scheduler decides which suitable Node should run a newly created Pod. It considers scheduling requirements and available resources.

Controller Manager

Controllers continuously compare the desired state with the current state and take action when a difference is found.

For example, if a Deployment requests three Pods but only two are available, the relevant controllers work to bring the number back to three.

What happens if a Worker Node fails?

Kubernetes detects when a Node becomes unhealthy and may mark it NotReady.

After the relevant detection and eviction process, Pods managed by controllers such as Deployments can be recreated on healthy Nodes, provided the cluster has enough resources and suitable Nodes are available.

This process is not necessarily immediate.

What happens if the Control Plane becomes unavailable?

Already-running application containers may continue running on Worker Nodes.

However, Kubernetes management operations can be affected. You may not be able to submit new requests, schedule new Pods or rely on controllers to respond to failures until the Control Plane becomes available again.

For high availability, production clusters commonly use multiple Control Plane instances. Three members are a common design for highly available control-plane and etcd deployments, but the exact architecture depends on the environment.

Kubernetes Control Plane and Worker Nodes

5. The written order: Understanding YAML

How do we tell the restaurant manager what we want?

We write an order.

In Kubernetes, we commonly describe the desired configuration using YAML files called manifests.

YAML is a human-readable data format. It uses indentation to show the relationship between configuration fields, so spaces matter.

Here is a simple Deployment example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          image: nginx:1.27
          ports:
            - containerPort: 80

Let's understand the important fields:

FieldMeaning
apiVersionIdentifies the Kubernetes API version
kindSpecifies the resource type
metadataContains information such as the resource name
specDescribes the desired configuration
replicasSpecifies how many Pod copies are required
selectorIdentifies the Pods managed by the Deployment
templateDefines the Pod configuration
containersLists the containers inside the Pod
imageSpecifies the container image

Read this YAML as an instruction:

"I want a Deployment named web. Keep three copies of my application running. Each Pod should run a container using the NGINX image."

Notice the line:

replicas: 3

We are not manually creating three Pods. We are telling Kubernetes the desired number.

This is called the declarative approach. We describe the state we want, and Kubernetes works to maintain it.

6. The three important tools: Deployment, ReplicaSet and Pod

Now imagine the restaurant manager receives an order for three identical dishes.

Someone must manage the order, someone must count the required dishes, and the kitchen stations must prepare them.

Kubernetes has a similar relationship.

Deployment: The main order

A Deployment manages an application and its updates.

It is commonly used for applications where multiple identical copies are required, such as websites, APIs and web services.

A Deployment helps manage:

  • The desired number of application replicas.

  • Rolling updates.

  • Rollbacks to earlier revisions.

  • The ReplicaSets associated with the application.

When you update an application's container image, the Deployment manages the rollout according to its update strategy.

A rolling update replaces Pods gradually. However, zero downtime is not automatically guaranteed; application readiness, resource availability and update configuration also matter.

ReplicaSet: The counter

A ReplicaSet makes sure that the required number of Pod replicas are running.

For example, if the desired number is three and one Pod disappears, the ReplicaSet works to create another Pod.

Usually, we do not create ReplicaSets directly. Deployments manage them for us.

Pod: The actual workload

The Pod runs the application containers.

For example, if we request three replicas, Kubernetes aims to maintain three application Pods.

The relationship is:

Deployment โ†’ ReplicaSet โ†’ Pods

Think of it like this:

  • Deployment = the restaurant manager's main order.

  • ReplicaSet = the person checking the number of dishes.

  • Pods = the workstations preparing those dishes.

Deployment - ReplicaSet - Pods

7. The labelled section: Understanding Namespaces

Imagine a large restaurant with separate sections for different teams.

The kitchen team handles food preparation, the delivery team handles orders, and the management team handles administration.

A Kubernetes cluster can also be divided logically using Namespaces.

Namespaces help organize and separate resources within a cluster.

For example:

  • default โ€“ the default Namespace for namespaced resources when none is specified.

  • kube-system โ€“ contains important Kubernetes system resources.

  • kube-public โ€“ intended for publicly readable information.

  • kube-node-lease โ€“ contains Lease objects used for Node heartbeat information.

Teams can create their own Namespaces, such as development, testing and production.

Two teams can create a Deployment with the same name in different Namespaces without a naming conflict.

Namespaces help with organization and resource management. They are not, by themselves, a complete security boundary.

8. How do users reach an application? Understanding Services

Imagine a restaurant has several kitchen stations preparing the same dish.

Customers should not need to know which particular station prepared their order. They need a reliable way to reach the restaurant.

Kubernetes provides this through a Service.

A Service provides a stable network endpoint for accessing a group of Pods selected using labels.

Why do we need it?

Pods are replaceable. Their IP addresses can change when they are recreated. A Service provides a stable way to reach the application without tracking individual Pod IP addresses.

Common Service types include:

Service typePurpose
ClusterIPMakes an application reachable inside the cluster
NodePortExposes a Service through a port on each Node
LoadBalancerRequests an external load balancer when supported by the environment
ExternalNameMaps a Service name to an external DNS name

Services, networking and Ingress deserve a closer look, so I'll cover them separately in another article.

Kubernetes Service Routing to Pods

9. Let's watch the kitchen work: A simple hands-on example

Reading about Kubernetes is useful, but seeing it in action makes the concepts easier to understand.

For this example, we will create a Deployment with three NGINX Pods.

First, check the Nodes:

kubectl get nodes

This command lists the Nodes in the current cluster.

Next, create a Deployment:

kubectl create deployment web --image=nginx:1.27 --replicas=3

This creates a Deployment named web with three desired replicas.

Check the Deployment:

kubectl get deployments

Check the Pods:

kubectl get pods -o wide

You should see three Pods. Their status should eventually become Running, provided the cluster can successfully pull the image and start the containers.

Now let's test Kubernetes self-healing.

Delete one of the Pods:

kubectl delete pod <pod-name>

Replace <pod-name> with the actual name shown by kubectl get pods.

Check the Pods again:

kubectl get pods

You should see the deleted Pod disappear and a replacement Pod appear.

The new Pod will have a different name.

Why did this happen?

The Deployment's ReplicaSet noticed that the number of available Pods no longer matched the desired number. It worked to create a replacement.

Try scaling the Deployment:

kubectl scale deployment web --replicas=5

Check the result:

kubectl get pods

You should now see Kubernetes working towards five replicas.

This is one of the most useful things to understand about Kubernetes:

You describe the number of application copies you want. Kubernetes uses controllers to work towards maintaining that desired state.

10. The whole kitchen on one page

Kubernetes conceptRestaurant analogy
ContainerPrepared cooking station with everything needed
PodServing tray carrying one or more containers
NodeKitchen station that runs Pods
Worker NodeStation where application work happens
Control PlaneRestaurant management team
API ServerFront desk
etcdOrder book
SchedulerOrder coordinator
Controller ManagerSupervisor
ClusterThe entire restaurant
YAMLWritten order
DeploymentMain application order
ReplicaSetCounter checking the number of dishes
NamespaceSeparate labelled section
ServiceStable way for customers to reach the restaurant

When should you use Kubernetes?

Kubernetes is powerful, but it is not necessary for every application.

For a small website or a simple application, one virtual machine or a basic hosting service may be enough.

Kubernetes becomes more useful when an organization needs to manage multiple containerized applications, scale workloads, coordinate deployments, recover from certain failures and operate applications across multiple machines.

It is widely used in cloud engineering, DevOps, Site Reliability Engineering (SRE) and platform engineering.

Where can you go next?

Once you understand the fundamentals, there are many more Kubernetes concepts to explore:

  • StatefulSet and DaemonSet.

  • Init Containers and Sidecar Containers.

  • ConfigMaps and Secrets.

  • Jobs and CronJobs.

  • PersistentVolumes and PersistentVolumeClaims.

  • Metrics Server and Horizontal Pod Autoscaler.

  • RBAC, ServiceAccounts and NetworkPolicies.

  • Helm and Kubernetes package management.

One idea to remember

If you remember only one thing from this article, remember this:

Kubernetes is a container orchestration platform. You describe the desired state of your applications, and Kubernetes works continuously to keep the cluster moving towards that state.

The best way to understand Kubernetes is not just to read about it. Create a Deployment, delete a Pod, watch it get replaced and change the replica count yourself.

That is when Kubernetes starts making sense.

📚 Sources
  1. kubernetes.io/docs/concepts/overview/
  2. kubernetes.io/docs/concepts/workloads/pods/
  3. kubernetes.io/docs/concepts/workloads/controllers/deployment/
  4. kubernetes.io/docs/concepts/services-networking/service/

❓ Questions readers ask

What is Kubernetes?

Kubernetes is an open-source platform that automates deploying, scaling and managing containerized applications.

What is a Pod in Kubernetes?

A Pod is the smallest deployable unit in Kubernetes and can contain one or more containers.

What is the difference between a Pod and a Node?

A Pod runs an application, while a Node is a machine that provides resources to run Pods.

What is a Deployment in Kubernetes?

A Deployment manages application Pods and helps maintain the desired number of replicas.

Does Kubernetes replace Docker?

No. Kubernetes orchestrates containers; it does not simply replace container tools such as Docker.

Read next →Docker vs Kubernetes: Understanding Containers⏱ 16 min

🛍️ Malathi Shetty's shelf

Courses, cohorts and more from the author
Malathi Shetty
Written by Malathi Shetty
Cloud & DevOps | AWS โ€ข Azure โ€ข Docker โ€ข Kubernetes โ€ข CI/CD
🏅 Contributor writer

Iโ€™m a Senior Software Quality Engineer learning and transitioning into Cloud & DevOps. Iโ€™m currently working hands-on with AWS, Azure, Linux, Docker, Kubernetes, CI/CD and DevSecOps. I share what I learn through practical projects and real-world examples.

Visit my ByteStoreLearning, building and sharing practical Cloud & DevOps experiences.

🌟 See Malathi Shetty's full profile: blogs, work and verified certificates

Get Malathi Shetty's next blog by email

One email a week when they publish. Add the weekly Best of ByteBlog too. No spam, unsubscribe with one click.

We email you once to confirm. By subscribing you agree to the privacy policy.

💬 Comments (0)

Top · Newest

Sign in to comment

Related blogs

🛍️✨ From the author · ByteStore1:1 DevOps Project & Learning Discussionโ‚น500View offer →