A Deployment in AKS (or in Kubernetes in general) is a controller that manages the lifecycle of your application pods. It ensures that a defined number of replicas of your application are running at all times.
✅ Why We Use a Deployment in AKS:
| Purpose | Description |
|---|---|
| Scaling | Easily scale your app up/down using kubectl scale or autoscaling. |
| Self-healing | If a pod crashes, the Deployment will automatically create a new one. |
| Rolling updates | You can update your app without downtime using rolling updates. |
| Version control | Supports rollback to previous versions of your app. |
| Declarative config | You define your app state in YAML — Kubernetes ensures it stays that way. |
Example Deployment YAML:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: myregistry.azurecr.io/my-app:v1
ports:
- containerPort: 80
🔄 How It’s Better Than Just Running a Pod
| Feature | Pod (standalone) | Deployment |
|---|---|---|
| Self-healing | ❌ No | ✅ Yes |
| Scaling | ❌ Manual (tedious) | ✅ Simple |
| Rolling update | ❌ Not supported | ✅ Built-in |
| Rollback | ❌ Not possible | ✅ Easy |
| Replica management | ❌ You create each manually | ✅ Managed automatically |
💡 In Simple Terms:
A Deployment is like a manager in AKS that keeps your application healthy, updated, and always running exactly how you define it — no matter what happens behind the scenes.
Leave a Reply