Learning path · 16 steps

Django on Kubernetes

Run Django on a cluster with config, ingress, probes, jobs, graceful shutdown, and autoscaling, then package it with Helm and GitOps.

from manifests to GitOpsDeployMigration JobHelmArgo CDChecklistFive guides that take one app from kubectl to GitOps

This path runs Django on Kubernetes: a Deployment with settings from ConfigMaps and Secrets, ingress, liveness and readiness probes, resource requests and limits, migrations and scheduled jobs, graceful shutdown and zero-downtime rollouts, disruption budgets and network policies, autoscaling, a Helm chart, GitOps with Argo CD, and security and production checklists.

It assumes a working container image; follow the Docker path first if you do not have one.

The steps

  1. Deploy Django on Kubernetes

    Deploy Django on Kubernetes with a Deployment, Service, Ingress, Secrets, readiness and liveness probes, and a migration Job that runs before each rollout.

  2. Manage Django Settings on Kubernetes With ConfigMaps and Secrets

    Deliver Django configuration on Kubernetes: ConfigMaps for non-secret settings, Secrets for credentials, envFrom versus mounted files, rolling pods when values change, encryption at rest, and syncing from external secret managers.

  3. Expose Django on Kubernetes With Gateway API or Ingress

    Route HTTPS traffic to Django on Kubernetes with the Gateway API or a maintained Ingress controller: HTTPRoutes or Ingress rules, TLS with cert-manager, forwarded headers, body size and timeouts, and moving off the retired ingress-nginx.

  4. Liveness and Readiness Probes for Django on Kubernetes

    Configure Kubernetes liveness, readiness, and startup probes for Django: separate cheap liveness and dependency-aware readiness endpoints, ALLOWED_HOSTS and HTTPS redirects, timeouts and thresholds, and avoiding restart storms during database outages.

  5. Set Kubernetes CPU and Memory Requests and Limits for Django

    Size Kubernetes resources for Django web and Celery pods: measure real usage, set memory requests near the working set and limits above peaks, avoid CPU throttling with sensible CPU limits, match Gunicorn workers to CPU requests, and use VPA recommendations.

  6. Run Django Migrations as a Kubernetes Job

    Run Django migrations exactly once per release on Kubernetes: a Job per image tag, waiting for completion in CI, lock timeouts, why init containers are risky, and handling failures.

  7. Run Django Scheduled Jobs as Kubernetes CronJobs

    Schedule Django management commands on Kubernetes with CronJobs: concurrencyPolicy Forbid, time zones, startingDeadlineSeconds, history limits, resource requests, secrets, and monitoring missed or failed runs, compared with Celery Beat.

  8. Graceful Shutdown for Django and Celery (SIGTERM)

    Shut down Django web servers and Celery workers without dropping requests or tasks: how Gunicorn, Uvicorn, and Celery handle SIGTERM, graceful timeouts, Docker stop_grace_period, Kubernetes preStop and terminationGracePeriodSeconds, and PID 1 pitfalls.

  9. Zero-Downtime Rolling Updates for Django on Kubernetes

    Make Kubernetes rolling updates of Django truly zero-downtime: configure maxSurge and maxUnavailable, readiness probes that reflect real readiness, preStop delays for endpoint propagation, Gunicorn graceful shutdown, backward-compatible migrations, and minReadySeconds.

  10. Keep Django Available During Kubernetes Node Maintenance With PodDisruptionBudgets

    Protect a Django deployment from voluntary disruptions on Kubernetes: add PodDisruptionBudgets for web and Celery, spread replicas across nodes and zones, set graceful termination and preStop delays, and avoid budgets that block node drains forever.

  11. Restrict Django Pod Traffic With Kubernetes NetworkPolicies

    Lock down network access for Django on Kubernetes: default-deny ingress and egress, allow the ingress controller to reach web pods, let web and Celery reach PostgreSQL, Redis, and DNS, permit required external APIs, and test policies without breaking the app.

  12. Autoscale Django on Kubernetes With the HPA

    Autoscale Django web pods on Kubernetes with the Horizontal Pod Autoscaler: accurate CPU requests, scaling on CPU or requests per second, min and max replicas, scale-down stabilisation, database connection limits, and testing under load.

  13. Deploy Django to Kubernetes with a Helm Chart

    Package Django for Kubernetes with a Helm chart: values per environment, Deployment and Ingress templates, a pre-upgrade migration hook, config checksums, and helm rollback.

  14. Deploy Django with Argo CD (GitOps)

    Deploy Django to Kubernetes with Argo CD: a config repository, an Application with automated sync, PreSync migration hooks, CI-driven image tag updates, and rollback by git revert.

  15. Django Kubernetes Security Checklist

    A security checklist for Django on Kubernetes: non-root containers with read-only filesystems, Pod Security Standards, minimal RBAC and service account tokens, secrets from a manager, NetworkPolicies, image scanning and signing, patched nodes, and audit logging.

  16. Django Kubernetes Production Checklist

    A production checklist for Django on Kubernetes: images, probes, resources, rolling updates, migrations as Jobs, secrets, static and media, Celery and Beat, autoscaling, disruption budgets, and observability.

Start with step 1

All learning paths · Browse by topic