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)