Deploy Django into Production with Kubernetes, Docker, & Github Actions. Complete Tutorial Series

Deploy Django into Production with Kubernetes, Docker, & Github Actions. Complete Tutorial Series

Learn how to deploy a production-ready Django application into a Kubernetes cluster.

Kubernetes is a tool to manage containers. This type of management is called orchestration because it does more than just manage the containers such as it will scale up and scale down resources as needed (among many other things).

Since Kubernetes is a massive tool, we’re going to be covering a practical implementation using a Docker-based Django application.

Django is a way to build web applications rapidly using Python. There are many ways to get Django into production so the question is why use K8S at all? There’s many reasons we’ll cover throughout this series but here are a few:
● Gracefully deploy Docker-based Django projects
● Scale up (or scale down) your web apps with ease
● Use a few or a lot of microservices internally or externally
● Self-heal when services go down
● Simplify app deployment (after initial configuration)
● Streamline your backend Infrastructure (provision virtual machines and let k8s do the rest)

Kubernetes can do a lot which makes it a great tool to learn but also a daunting one at that. To make it more approachable here’s what we’ll be doing:

● Start a Python Virtual Environment
● Create a bare bones production-ready Django project
● Create a Dockerfile to describe our environment (much like this blog post: https://www.cfe.sh/blog/django-on-docker)
● Use a managed Database service from DitgitalOcean
● Install Kubernetes Command Line tool locally (kubectl)
● Start a Kubernetes Cluster on DigitalOcean
● Provision a Deployment and Service for our Django project
● Implement Github Action Workflows to automate future deployments

▶︎ References
● Django on Docker guide: https://cfe.sh/blog/django-on-docker
● Docker & Docker Compose tutorial series: https://cfe.sh/projects/docker-and-docker-compose
● Github Actions guide: https://cfe.sh/blog/django-github-actions
● DigitalOcean $100 credit for new accounts: https://do.co/cfe-youtube
● Project Code: https://github.com/codingforentrepreneurs/Django-Kubernetes

★ Subscribe: https://cfe.sh/youtube ★

⦿ New to Django? Checkout the Try Django Tutorial Series: https://www.youtube.com/playlist?list=PLEsfXFp6DpzRMby_cSoWTFw8zaMdTEXgL

▶︎ Chapters

00:00:00 Welcome to Django & Kubernetes
00:02:08 Requirements & Recommendations
00:07:12 Install Kubernetes Command Line Tool Kubectl on macOS
00:12:49 Install Kubernetes Command Line Tool Kubectl on Windows
00:19:08 Create the Python Virtual Environment
00:24:28 Install Requirements & Start Django Project
00:33:01 Environment Variables with a dotenv file
00:36:10 Setup django dotenv to read our dotenv file
00:41:54 Update Django settings for Database & Environment Variables
00:47:29 Docker, Dockerfile & dockerignore
01:01:13 Create a migration script
01:09:46 Docker Compose Part 1
01:32:48 Docker Compose Part 2
01:41:43 Provision Kubernetes on DigitalOcean
01:55:20 Connect to Kubernetes with kubectl & kubeconfig
02:03:41 Deploy your First Container on Kubernetes
02:14:00 Expose your Deployment with a Load Balancer
02:26:11 Deploy a Minimal FastAPI App
02:34:24 DigitalOcean Container Registry
02:38:36 Build & Push Docker Container to DO Container Registry
02:45:08 Managed PostgreSQL Database
02:52:44 Kubernetes Secrets from env
02:57:17 Django Deployment & Service
03:11:21 Full Deployment & Fix Errors
03:24:55 Deployment Guide
03:38:57 Github Actions Test Django Automatically
03:55:31 Github Actions Build & Push Docker Container to DigitalOcean
04:11:09 Github Actions Django Deployment on Kubernetes
04:29:01 Django Static Files on DigitalOcean Spaces
04:54:28 New Django App, Models, & Tests
05:10:55 Thank you

https://www.youtube.com/watch?v=NAOsLaB6Lfc

#financialfreedomllc #businesstips #business #entrepreneur #businessowner #entrepreneurship #marketing #smallbusiness #businesscoach #digitalmarketing #success #entrepreneurlife #motivation #businessideas #businessgrowth #businesswoman #businessman #businessquotes #businessowners #businessstrategy #startup #businesslife #businessmindset #businessminded #entrepreneurs #businessadvice #entrepreneurmindset #marketingtips #onlinebusiness #branding

Scroll to Top