Kubernetes Architecture for Developers: Pods, Services, Deployments & Ingress Demystified

Bridging the Developer-to-Kubernetes Divide

Containerizing an application with Docker is straightforward: write a Dockerfile, run docker build, and launch the container on a server. However, running containers in production requires automated scaling, self-healing restarts, healthchecks, zero-downtime rolling updates, and intelligent traffic routing across dozens of physical machines.

This is the domain of Kubernetes (K8s). While its operational surface area is notoriously intimidating, software developers only need to master four fundamental primitives to deploy and manage production microservices: Pods, Deployments, Services, and Ingress.

In this architectural guide, we translate Kubernetes concepts into pragmatic software engineering workflows with clean, annotated manifest examples.


The Kubernetes Core Abstraction Stack

Kubernetes Routing Hierarchy:

Internet ──► Ingress Controller (TLS Termination, Routing Rules)
                     │
                     ▼
             K8s Service (Stable ClusterIP & Internal Load Balancer)
                     │
         ┌───────────┴───────────┐
         ▼                       ▼
    [Pod Replica 1]         [Pod Replica 2]     (Managed by Deployment)
  (Node.js Container)     (Node.js Container)

1. Pods vs. Deployments: Declarative Lifecycle Management

In Kubernetes, you never deploy standalone containers or raw Pods directly. Pods are ephemeral and will not restart if the underlying host node dies. Instead, you declare a Deployment, which manages a ReplicaSet to maintain the desired number of healthy Pods:

# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-service
  labels:
    app: api-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api-service
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0 # Zero-downtime deployment!
  template:
    metadata:
      labels:
        app: api-service
    spec:
      containers:
        - name: app
          image: ghcr.io/org/api-service:v2.1.0
          ports:
            - containerPort: 3000
          resources:
            requests:
              memory: "256Mi"
              cpu: "250m"
            limits:
              memory: "512Mi"
              cpu: "500m"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 3000
            initialDelaySeconds: 15
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: 3000
            initialDelaySeconds: 5
            periodSeconds: 5

2. Services: Stable Networking for Ephemeral Pods

Because Pods are frequently created and destroyed during rolling updates, their internal IP addresses change constantly. A Service provides a permanent internal IP and DNS name (e.g. api-service.default.svc.cluster.local), automatically load balancing traffic across all healthy Pods matching its label selector:

# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: api-service
spec:
  type: ClusterIP # Internal load-balanced VIP
  selector:
    app: api-service
  ports:
    - protocol: TCP
      port: 80
      targetPort: 3000

3. Ingress: Exposing Services to the Outside World

An Ingress resource acts as the smart reverse proxy routing external HTTP/HTTPS traffic to internal Services based on hostnames and URL paths:

# ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - api.techaventure.co.in
      secretName: api-tls-cert
  rules:
    - host: api.techaventure.co.in
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: api-service
                port:
                  number: 80

Frequently Asked Questions (FAQ)

What is the difference between Liveness and Readiness probes?

Liveness probes determine if the container process is running. If it fails, Kubernetes kills the container and restarts it. Readiness probes determine if the application is ready to accept incoming traffic (e.g. database connections established). If a readiness probe fails, Kubernetes stops sending HTTP requests to that Pod without killing it.


Continue expanding your technical depth with our related engineering guides:

  • Deploying with Docker Compose: Multi-container orchestration for web applications and databases. Explore the complete guide: Deploying with Docker Compose.
  • Nginx Reverse Proxy & SSL Hardening: Hardening Nginx reverse proxies with TLS 1.3 and security headers. Explore the complete guide: Nginx Reverse Proxy & SSL Hardening.

Published by Mohit Kumar under DevOps & Cloud Infrastructure. Read our containerization guide on The Complete Docker Handbook for Backend Developers.

Authoritative Reference: Consult the Kubernetes Official Concepts & Documentation for normative standards and release specifications.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top