Introduction to K8s and it's Concept

Concepts: Pods, Nodes, Services, Deployments, ReplicaSets

Learning Outcome

4

Understand how these components work together for scalability

3

Describe how Services enable stable communication

2

Explain how ReplicaSet and Deployment maintain desired state

1

Identify the role of Nodes and Pods in a cluster

Topic Name-Recall(Slide3)

Think of Kubernetes as a Shopping Mall!

Imagine a large shopping mall:

The entire mall = Kubernetes Cluster

Think of Kubernetes as a Shopping Mall!

Each floor = Node

Each shop = Pod

Mall Management = Deployment

Backup shop copies = ReplicaSet

Help Desk Counter = Service

Think of Kubernetes as a Shopping Mall!

If one shop closes suddenly, customers should still be able to buy products

1

If too many customers arrive, more shops should open.

2

If customers don’t know shop locations, they should ask at the help desk

3

This is exactly what Kubernetes does for applications

From Mall Analogy to Real Kubernetes Components

Why do we need these components?

When running applications in containers:

Containers may crash

Traffic may increase suddenly

Servers may fail

Pod IP addresses keep changing

We need scaling and load balancing

From Mall Analogy to Real Kubernetes Components

Without proper management:

Users see errors

Apps become slow

Systems become unstable

From Mall Analogy to Real Kubernetes Components

Just like a Mall Needs

Multiple shops

Backup shops

A management team

A help desk

From Mall Analogy to Real Kubernetes Components

Applications also need:

Transition from Analogy to Technical Concept(Slide 5)

What is Clustering in Kubernetes?

Clustering means multiple machines (Nodes) working together as one single system

Instead of running application on one single server,
We distribute workload across multiple Nodes

Cluster = Group of Nodes managed by Kubernetes

In Kubernetes:

A Cluster consists of:

  • Control Plane

  • Multiple Worker Nodes

How clustering works in Kubernetes:

Nodes join a Cluster

Multiple computer(Nodes) join a cluster

1

Control Plane manages all Nodes

Control Plane manages and oversees all Nodes

2

Scheduler Places Pods

Scheduler decides On which Node Pod should run

3

Pods Rescheduled on failure

If one Node fails:

Pods are rescheduled on another Node

4

Traffic is Distributed

Traffic is evenly balanced across Pods on all Nodes

5

How clustering works in Kubernetes:

Example:

Pod A

Cluster ensures application remains available

Pod A

Pod B

Pod B

Pod C

If Node 2 fails

  • Pod B is recreated on Node 1 or Node 3

What is a Node?

A Node is a worker machine in Kubernetes

It can be :

Physical Machine

Virtual Machine

Cloud Instance

It is where containers actually run

What is a Node?

Kubelet

  • Communicates with Control Plane
  • Ensures containers are running correctly

Container Runtime

  • Runs and manage containers
  • Example: containerd , CRI-O

Kube-proxy

  • Manage networking inside the node
  • Handles traffic routing between Pods

How Node works?

Control Panel

Sends Instructions to Node

1

Node

Kubelet

Receive Instructions

2

Container Runtime

Pulls image and runs container

3

Kube-proxy

Manages networking

4

How Node works?

Node = Execution environment

If Node fails:

Pods rescheduled to another Node

What is a Pod?

Pod is the smallest deployable unit in Kubernetes wrapping around one or more containers

Containers inside a Pod:

Share the same IP address

Share the same network namespace

Can share storage using Volumes

What is a Pod?

Important understanding:

Pod is NOT equal to container.

Pod is a logical application unit that Kubernetes manages.

If your application has:

  • Main container (app)

  • Sidecar container (logging / monitoring)

Both run inside the same Pod

How Pod works:

Scheduler

Assigns Pod to a Node

Pods

Gets a unique IP inside the cluster

Kubelet

Starts the containers

If Container Crashes

It restarted inside same Pod

Important Concept:

Pods are Temporary

What is a ReplicaSet?

ReplicaSet is a controller that ensures:

 

A fixed number of identical Pod replicas are always running

 

What is a ReplicaSet?

Example

It always maintains the correct number

  • If you define replicas: 3

 

ReplicaSet ensures:

  • Exactly 3 Pods exist at all times

If Pod Crashes

It creates a new one

If Extra Pod Exist

It Removes them

Why is ReplicaSet Important?

High availability

Fault tolerance

Self-healing

Differentiate Between Labels and Selectors

Attach Identifying metadata to pods

Use to describe Pods

They are Key-value Pair

Filter Pods by matching label

Use to Find Pods by label

They are used for Filtering Conditions

Labels

Selectors

How Does ReplicaSet Work?

Actual State

Running Pods

Desired State

3 Pods

Replicaset

Fixes to match Desire state

Adds Pods

Remove Crash Pods

What is Deployment?

Deployment is a higher-level controller built on top of ReplicaSet

Rolling updates

Rollbacks

Scaling

ReplicaSet

Application updates

Deployment manages:

Application lifecycle manager When you create a Deployment:

When you update container image:

Ensures zero downtime

Deployment

Creates New ReplicaSet

Gradually replaces old Pods

Keeps history of versions

Application lifecycle manager When you create a Deployment:

So,

Text

ReplicaSet

Maintains count

deployment

Manages versions + lifecycle

What is Service?

Problem

Pods have dynamic IP addresses it means it can change

Service provides:

Stable network identity for Pods

What is Service?

Solution: Service gives:

Permanent IP (ClusterIP)

DNS name

Load balancing

How Service works:

1

Service is created with a label selector

2

It finds all Pods matching those labels

3

It creates a stable virtual IP (ClusterIP)

4

Traffic sent to Service IP is forwarded to one of the Pods

Service uses:

kube-proxy

iptables or IPVS rules to distribute traffic

If Pod crashes → where does traffic shift?

Step 2

Kubernetes 

removes the failed Pod from Service endpoints

Step 3

Service automatically updates its internal list

Step 4

Traffic is shifted to remaining healthy Pods

Step 1

ReplicaSet creates a new Pod

How Kubernetes Manages Applications

Cluster

Group of Nodes working as one

Node

Machine inside cluster

Pod

Temporary application unit

How Kubernetes Manages Applications

ReplicaSet

Ensures required number of Pods

Deployment

Manages lifecycle and updates

Service

Stable network layer that routes traffic to healthy Pods

Summary

5

Service provides stable access to Pods

4

Deployment manages updates and scaling

3

ReplicaSet maintains the required number of Pods

2

Pod is the smallest deployable unit

1

Node runs the application workload

Quiz

Which component is responsible for rolling updates?

A. ReplicaSet

B. Pod

C. Deployment

D. Node

Quiz

Which component is responsible for rolling updates?

A. ReplicaSet

B. Pod

C. Deployment

D. Node