Deploying Your Production Blog - Next.js, Strapi, Database and ConfigMaps

A production-ready Strapi and Next.js deployment on Kubernetes needs a persistent database, externalized configuration, automated TLS, horizontal autoscaling, and scheduled backups. This template wires all of that together using a PostgreSQL StatefulSet, Kubernetes Secrets and ConfigMaps, a Let's Encrypt ClusterIssuer, a Horizontal Pod Autoscaler, and a daily backup CronJob in a single deployable manifest.
| Component | Type | Port | Role |
|---|---|---|---|
| PostgreSQL | StatefulSet + Headless Service | 5432 | Primary database with 10Gi storage, health probes, and memory limits |
| Media Storage | PersistentVolumeClaim | - | 10Gi volume for Strapi media uploads |
| Backup Storage | PersistentVolumeClaim | - | 20Gi volume for database backup files |
| ConfigMap | ConfigMap | - | Non-sensitive environment configuration for Strapi and Next.js |
| Secrets | Secret | - | Base64-encoded credentials for database and application |
| ClusterIssuer | ClusterIssuer | - | Automated Let's Encrypt TLS certificate provisioning |
| Ingress | Ingress | 443 | HTTPS termination and path-based routing |
| Horizontal Pod Autoscaler | HorizontalPodAutoscaler | - | Scales pods at 70% CPU and 80% memory thresholds |
| Backup CronJob | CronJob | - | Daily PostgreSQL backup at 2 AM with gzip compression and 7-day retention |
PostgreSQL runs as a StatefulSet with a headless Service for stable DNS and dedicated PVCs for data, media, and backups. Strapi reads non-sensitive settings from a ConfigMap and receives credentials via Kubernetes Secrets at pod startup. An NGINX Ingress with Let's Encrypt TLS handles external traffic. The HPA scales Strapi replicas when CPU exceeds 70% or memory exceeds 80%. A CronJob runs daily at 2 AM to produce gzip-compressed PostgreSQL backups with 7-day retention.
kubectl get pods,pvc -n <namespace>.https://<your-domain>/admin and confirm the Strapi admin panel loads over HTTPS.This template configures the full production stack for a Strapi and Next.js blog on Kubernetes, from a PostgreSQL StatefulSet with automated backups to HTTPS and horizontal autoscaling. For a full walkthrough, read Building and Deploying a Modern Blog Platform with Next.js, Strapi, and Kubernetes: Part 3.