DEV Community

Shiva Charan
Shiva Charan

Posted on

Pod - Deployment - Service

๐Ÿงฑ 1. Pods (Smallest unit in Kubernetes)

๐ŸŸฆ What is a Pod?

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

๐Ÿง  Think of a Pod like:

A wrapper around your container(s).

Each Pod gets:

  • Its own IP address
  • Shared network namespace
  • Shared storage volumes

Example:

A Pod might contain:

  • 1 container โ†’ nginx or
  • 2 containers โ†’ app + sidecar (logging agent)

Why Pods exist:

Containers need a Kubernetes-native โ€œpackageโ€ to run inside the cluster.
That package is a Pod.


๐Ÿ“ฆ 2. Deployments (Controllers that manage Pods)

๐ŸŸฆ What is a Deployment?

A Deployment is a Kubernetes object that tells the cluster:

โ€œRun this many Pods, keep them healthy, and update them safely.โ€

A Deployment manages:

  • Creating Pods
  • Maintaining replica count
  • Rolling updates
  • Rollbacks
  • Self-healing

Example:

replicas: 5
Enter fullscreen mode Exit fullscreen mode

Deployment ensures 5 pods always exist.

โœ” Why Deployments exist:

Pods are not self-healing and not scalable.
Deployments add automation around Pods.


๐ŸŒ 3. Services (Stable access to Pods)

๐ŸŸฆ What is a Service?

A Service provides a stable IP and DNS name to access Pods.

Pods come and go โ†’ their IPs change
Service โ†’ always stays the same

What Services do:

  • Load-balance traffic to Pods
  • Provide stable access even if Pods restart
  • Allow communication between microservices

Types of Services:

  • ClusterIP (default, internal)
  • NodePort (expose app on nodeโ€™s port)
  • LoadBalancer (cloud load balancer)
  • Headless Service (no load balancing, direct DNS)

โœ” Why Services exist:

Without Services, apps inside Kubernetes would not know how to talk to Pods.


๐Ÿ—‚๏ธ 4. Configurations (ConfigMaps & Secrets)

๐ŸŸฆ What are Configurations?

They are Kubernetes objects used to store settings for applications.

Two types:

ConfigMap

Stores non-sensitive data:

  • App settings
  • File contents
  • Environment variables

Secret

Stores sensitive data:

  • Passwords
  • API keys
  • Certificates

โœ” Why Configurations exist:

You should never hard-code sensitive or dynamic values inside the container image.
Kubernetes stores them separately and injects them at runtime.


๐Ÿง  5. State of Every Component (What Kubernetes stores in etcd)

๐ŸŸฆ What is the โ€œStateโ€ of a Component?

State means the actual condition of something right now.

Kubernetes stores the state of everything in etcd, such as:

Podsโ€™ state:

  • Running
  • Pending
  • Failed
  • Restarts
  • Conditions
  • Node assigned

Deployment state:

  • How many replicas are running
  • How many updated replicas
  • Rollout status

Node state:

  • Healthy or NotReady
  • Resource usage
  • Labels and taints

Service state:

  • ClusterIP
  • Endpoints (which Pods it is routing to)

ConfigMap/Secret state:

  • Key-value pairs
  • Version

Container state:

  • Ready
  • Started
  • Exit codes
  • Crash loops

๐ŸŸฉ Why Kubernetes stores state:

  • To know desired state (what you want)
  • To know actual state (what is happening)
  • To let controllers fix mismatches

Example:
Desired: 5 Pods
Actual: 3 Pods running
โ†’ Controller creates 2 new Pods automatically


๐ŸŽฏ Final Summary

Concept Simple Meaning Purpose
Pods Smallest unit; wrapper for containers Runs containers
Deployments Manage Pods at scale Scaling, rollouts, self-healing
Services Stable access to Pods Networking + load balancing
Configurations Store settings & secrets Decouple config from code
State of Components Clusterโ€™s memory in etcd Enables automation & self-healing

Top comments (0)