DEV Community

Cover image for Part-79: πŸš€ Kubernetes Fundamentals – Pods, ReplicaSets, Deployments & Services
Latchu@DevOps
Latchu@DevOps

Posted on

Part-79: πŸš€ Kubernetes Fundamentals – Pods, ReplicaSets, Deployments & Services

Kubernetes Fundamentals

When learning Kubernetes, the first concepts you’ll hear about are Pods, ReplicaSets, Deployments, and Services. These are the building blocks of every Kubernetes application. Let’s break them down in simple terms.

g2


🟒 Pod

  • A Pod is the smallest unit in Kubernetes.
  • Think of it as a wrapper around your application container(s).
  • A Pod usually runs one instance of your application.

πŸ‘‰ Example: If you run an Nginx web server, it will live inside a Pod.


🟒 ReplicaSet

  • A ReplicaSet makes sure the desired number of Pods are always running.
  • If a Pod crashes, the ReplicaSet will create a new one.
  • Helps ensure high availability.

πŸ‘‰ Example: If you want 3 replicas of your Nginx Pod, the ReplicaSet will maintain them.


🟒 Deployment

  • A Deployment manages ReplicaSets for you.
  • It makes updating applications easier (rolling updates, rollbacks).
  • Best suited for stateless applications.

πŸ‘‰ Example: You deploy an Nginx app with 3 replicas. If you upgrade the version, the Deployment will replace old Pods gradually.


🟒 Service

  • A Service exposes your Pods to the network.
  • Provides a stable virtual IP (VIP) so you don’t have to worry about Pods changing.
  • Acts as a load balancer in front of Pods.

πŸ‘‰ Example: Even if Pods die and restart, you can still access your app using the Service IP/Name.


πŸ› οΈ Kubernetes – Imperative vs Declarative

When working with Kubernetes, you can interact in two ways:

g1

Approach How it works Example
Imperative You tell Kubernetes what to do step by step using kubectl commands. kubectl run nginx --image=nginx
Declarative You define what you want in a YAML file, and Kubernetes figures out how to make it happen. kubectl apply -f deployment.yaml

Here’s a simple visual:

  • Imperative Approach β†’ Uses only kubectl commands.
  • Declarative Approach β†’ Uses YAML + kubectl.
  • Both work with Pods, ReplicaSets, Deployments, and Services.

βœ… Summary

  • Pod β†’ Smallest unit, runs your app.
  • ReplicaSet β†’ Ensures the right number of Pods are running.
  • Deployment β†’ Manages ReplicaSets, supports upgrades.
  • Service β†’ Exposes Pods to the network with a stable IP.
  • Imperative vs Declarative β†’ Choose commands (imperative) or YAML (declarative).

🌟 Thanks for reading! If this post added value, a like ❀️, follow, or share would encourage me to keep creating more content.


β€” Latchu | Senior DevOps & Cloud Engineer

☁️ AWS | GCP | ☸️ Kubernetes | πŸ” Security | ⚑ Automation
πŸ“Œ Sharing hands-on guides, best practices & real-world cloud solutions

Top comments (0)