Scaling Django with Kubernetes
5aket |
1
Description:
It has always been advised to architect our apps to both scale, fault/load tolerance and be resilient to arbitrary failure. Most services are implemented as a container under the hood. Traditionally, you would deploy django to some virtual machine instance. PaaS has been the buzz word for quite sometime now, and is paving way for CaaS - Container as a Service. Containers, most often use Docker to produce immutable, isolated and quick to sign up application images.
With containers there have been few known challenges:
How do multiple containers talk to each other?
How do I horizontally scale my container service?
How do multiple container services discover each other?
How do we secure our container network?
How do we deploy new containers and roll back previous ones?
To answer the above problems and address the issue of orchestration, scheduling and other automation tasks Kubernets was released by Google.
This talk is going to be about how we can use Docker containers and Kubernetes to help our production Django web application to be scalable, secure and fault tolerant.
The ideas expressed in the workshop are not tied closely to Django, they can very easily be extrapolated to a cluster design consisting of web server, database server, load balancer and other standard components. Django just happens to be one amongst the most popular python web frameworks, which accounts for its selection.
Specifically we will look into the following list during our workshop :
- How Docker and Kubernetes is used.
- The deployment of Docker images.
- Building application images using Source to Image.
- Handling application configuration and secrets.
- Logging and monitoring of applications.
- Scaling up of containers.
- Service Discovery inside the cluster.
- Securing the cluster.
Overview of Content
Deploying a sample Django App - gunicorn
Overview of Multiple Ways to Deploy it
Pass
Traditional VMs
Containers
Enter Docker
Docker Overview
Creating Containers
Running Containers
Backup Images
Data Volumes
Pros, Cons & Challenges with Containers
Challenges with Docker Container
Scheduling on an appropriate node
Service/Microservice/Third Party Service Discovery
Scaling it up and down - manually / automatically
Safe update/rollback. A/B Canary Test
Environment Variables, Namespacing & Secrets Management
Enter Kubernetes
Kubernetes Architecture overview
Overview of kubectl - the CLI to interact with cluster
Deploy django container on kubernetes
Understanding services & pods
Adding additional containers - postgresql
Additonal
Continuous Integration & Delivery
Canary Testing
Horizontal Scaling
When & When NOT to use Kubernetes
Popular Alternatives
Prerequisites:
You should be well aware of django or any other popular web framework, and should have pushed a web app to public usage.
Speaker Info:
Saket is founder of a SaaS product named Sosio. Sosio caters to the data needs of non-profits and SMEs. He has been semi-active in tech-conferences attending and delivering talks across the globe. In his personal capacity he has introduced Python to more than 500 individuals, and conducted training sessions at corporate houses like Oracle. In his previous life, he spent good chunk of his time optimising computational mechanics algorithms.