Modern Python Projects Transcripts
Chapter: Deployment
Lecture: Docker containers and kubernetes
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Yet another way to deploy your application is to turn it into a container. This way got very popular with the introduction of docker,
0:08
and now a lot of containerized applications are running under the kubernetes orchestration.
0:16
This is a great solution if you have a massive application that you need to quickly
0:20
scale up or scale down, depending on the traffic spikes or if you deploy your
0:26
application multiple times per day, so you need to set up some continuous delivery pipeline
0:31
On the other hand, learning kubernetes only to set up a cluster for a website that has less than a few 1000 visitors per day is a terrible overkill
0:40
But the idea of containers is pretty great, and I recommended even for medium and small projects.
0:47
Basically, if you can build a container with your application and make it work on
0:52
your computer, then you can take this container deployed on the server, and it will also work there.
0:58
I saw this joke on the Internet when one developer was saying it works on my machine and his boss responded, Okay,
1:05
then we will ship your machine to the customer and the caption was. That's how docker was born, and I think it pretty accurately shows how docker and
1:15
containers work. I use the word container a lot, so if you're new to Docker,
1:20
you might be confused. Container is basically a package that contains your application and all
1:26
the dependencies that it requires, so it's very similar to the executable Python application that we built in the last chapter.
1:34
It's like an executable application that docker can run. It can be a Django or flask website. It can be a command line application,
1:43
or it could be a GUI application. It can be basically anything that you can run on your computer. So, once we have such container,
1:51
how do we deploy it? One way is to spin up a virtual private server install docker and then run this docker container.
2:00
Some hosting providers can further simplify this process. For example, digital ocean has those one click applications that lets you create a server
2:09
with some preinstalled software, and as you can see, they have one for docker. So when you click this create docker droplet,
2:17
it will create a server with docker installed and ready to use. You can also search for a phrase managed docker hosting.
2:24
This will return you a list of different services that works like Heroku. But for Docker Containers, they will take care of,
2:32
setting up everything for you, and all you need to do is to give them your container. And if your application is really big and you need a lot of
2:41
machines, you can use kubernetes. The main difference between kubernetes and Docker is that kubernetes works across multiple machines.
2:49
That's why we often say kubernetes class On the other hand, docker runs on a single machine. You can create and manage a kubernetes cluster yourself,
3:00
but you can also search for manage kubernetes platforms. This will return you a list of companies that can setup a kubernetes cluster
3:07
for you and give you some interface to easily. Manage it. As you can see, we have a manage kubernetes from digital ocean, something from ovh and so on.