Deployments

🚀 What It Does

A Deployment ensures that a specified number of pod replicas are running and up to date. It automates the process of:

  • Creating pods
  • Updating them in a controlled way (e.g., rolling updates)
  • Rolling back to previous versions if needed

🧩 Key Features

The key features of Deployments include:

  • Declarative Updates: You define the desired state in a YAML/JSON file, and Kubernetes makes it happen.
  • Rolling Updates: Gradually replaces old pods with new ones to avoid downtime.
  • Rollback: If something goes wrong, you can revert to a previous version.
  • Scaling: Easily scale the number of replicas up or down.

⚙️ How It Works

  1. You define a Deployment with a pod template and desired replica count.
  2. Kubernetes creates a ReplicaSet to manage those pods.
  3. When you update the Deployment (e.g., change the container image), it creates a new ReplicaSet and gradually shifts traffic to the new pods.
  4. Old ReplicaSets are kept for rollback purposes.

Kubernetes Deployment Kubernetes Deployment