OR REACH ME ON

    My First Experience with Kubernetes for Deployments

    In 2023, I took my first serious dive into Kubernetes (K8s). Until then, I was comfortable using Docker and docker-compose for local development, and sometimes pushing containers directly to cloud providers. But when projects demanded scalability, resilience, and team-ready deployments, Kubernetes became the natural next step.

    At first, it felt overwhelming — YAML files, pods, services, ingresses — but once I deployed my first app, the puzzle started making sense.

    Why Kubernetes?

    • Scalability  Easily run multiple replicas of services.

    • Self-healing  Crashed pods restart automatically.

    • Service discovery  Built-in load balancing.

    • Portability  Same config works across AWS, GCP, Azure, or on-prem.

    My First Kubernetes Deployment

    I started with a Rails API + React frontend.

    Deployment for Rails

    				
    					apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: rails-backend
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: rails-backend
      template:
        metadata:
          labels:
            app: rails-backend
        spec:
          containers:
          - name: rails
            image: myrepo/rails-backend:latest
            ports:
            - containerPort: 3000
    				
    			

    Service for Rails

    				
    					apiVersion: v1
    kind: Service
    metadata:
      name: rails-service
    spec:
      selector:
        app: rails-backend
      ports:
        - protocol: TCP
          port: 80
          targetPort: 3000
      type: ClusterIP
    				
    			

    Deployment for React

    				
    					apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: react-frontend
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: react-frontend
      template:
        metadata:
          labels:
            app: react-frontend
        spec:
          containers:
          - name: react
            image: myrepo/react-frontend:latest
            ports:
            - containerPort: 3000
    				
    			

    Accessing the App

    Initially, I exposed my frontend with a NodePort service (not ideal for production, but easy for learning). Later, I learned to configure an Ingress Controller with NGINX for proper routing.

    Lessons Learned

    1. YAML Fatigue  Writing configs by hand gets messy. Using Helm charts simplified things.

    2. Resource Limits  Without setting CPU/memory limits, pods could hog resources.

    3. Logging & Monitoring  Kubernetes doesn’t magically give logs; tools like Prometheus + Grafana became critical.

    4. Local Testing  minikube and kind were lifesavers for running clusters locally.

    🎯 Final Thoughts

    Kubernetes was intimidating at first, but once I got through the first deployment, I realized it wasn’t about complexity — it was about control and reliability at scale.

    By late 2023, I wasn’t using Kubernetes for every project, but whenever I needed scalability or multiple services working together, it became my go-to.