marcio.cloud
All projects

Containers

Kube-news — Containerised News App on Kubernetes

A Node.js/Postgres news application packaged with Docker and deployed on Kubernetes. Demonstrates the full container lifecycle: image build, registry, manifests, services, ingress, and rolling updates.

DockerKubernetesNode.jsPostgreSQLHelmIngresskubectl
Architecture diagram for Kube-news — Containerised News App on Kubernetes
Architecture diagram — created in Lucidchart.

Problem

I wanted to prove I could run a real stateful-ish workload on Kubernetes — not just deploy nginx — and understand the trade-offs between Deployments, StatefulSets, ConfigMaps and Secrets in practice.

Solution

Containerised a Node.js news application and its Postgres dependency, wrote multi-stage Dockerfiles to keep the runtime image small, and authored Kubernetes manifests for Deployment, Service, Ingress, ConfigMap (env) and Secret (DB credentials). Used a Helm-style values pattern so the same manifests deploy to dev and prod with different replica counts and resource requests.

Architecture

  • Multi-stage Dockerfile: builder stage compiles, runtime stage ships only artefacts (~80 MB).
  • Deployment with 3 replicas, rolling update strategy (maxUnavailable: 1).
  • PostgreSQL StatefulSet + PersistentVolumeClaim for durable storage.
  • Service of type ClusterIP fronted by an Ingress with TLS termination.
  • Liveness + readiness probes wired to /health to drive rolling updates.

Outcomes

  • Rolling deploys with zero downtime measured against a synthetic load test.
  • Image size reduced ~60% by switching to a multi-stage build with Alpine.
  • Clear separation of config (ConfigMap) and secrets (Secret) so the same image promotes across environments.

What I'd do differently

Probes are not optional. Without a readiness probe, Kubernetes routes traffic to a pod that's still starting and you get a wave of 502s on every deploy. Most container outages I've seen trace back to missing or wrong probes.