DEV Community

Jayanth Dasari
Jayanth Dasari

Posted on

Day-27 K8s Deployment Manifests & The Reconciliation Loop

I am continuing my deep dive into Kubernetes, and today was all about moving from imperative commands to declarative configuration. I focused on understanding Deployments and ReplicaSets.📄 The Deployment YAMLI spent time writing my first proper deployment.yaml. The power here is version control—I can commit this file to Git, and my infrastructure is now code.Here is the structure I explored today:YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-web-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
Enter fullscreen mode Exit fullscreen mode

🔄 The ReplicaSet ControllerThe biggest "aha!" moment for me was understanding exactly what the ReplicaSet does.The Deployment manages the ReplicaSet, and the ReplicaSet manages the Pods. It acts as a controller that ensures:$$Desired State == Actual State$$If I define replicas: 3 in the manifest, the ReplicaSet ensures there are always 3 pods running.If I delete a pod manually? The ReplicaSet sees the count drop to 2 and immediately starts a new one.If I accidentally create too many? It terminates the extras.It is a constant loop of observation and correction. This self-healing capability is exactly why Kubernetes is the standard for cloud orchestration.🚀 Next StepsNow that I understand how to define the state, next I plan to look into Services to understand how to actually expose these deployments to the outside world.
Linkedin: https://www.linkedin.com/in/dasari-jayanth-b32ab9367/

Top comments (0)