Hey, everyone.
And welcome back.
In today's video, we will be discussing about one of the very interesting topic, which is container
orchestration.
Now, the container orchestration is all about managing the lifecycle of the container, especially
in the large and dynamic environments.
Now, this can be better explained with the small demo here where you have three virtual machine soldiers.
So you have virtual machine, one virtual machine, two, virtual machine three, and you have a web
server container, you have an app server container in the virtual machine one, and same with the virtual
machine two.
You have a web server container and the app server container.
Now, if you have a very small environment like this, you can go ahead and start the container manually.
But there is a lot of aspects other than starting the container.
One of them is monitoring.
So let's say that this specific web server container went down and in order for your production environment
to work perfectly, you need to have a minimum of two web server containers to be always up and running.
Now, what happened is you install it and the web server container went down.
So the question is who will monitor this specific web server container?
And that monitoring script should also have an event driven mechanisms in such a way that if this web
server container went down, it also restarts the container or due to some reason, if, say, the container
is not restarting, then that script should automatically start a new web server container in the virtual
machine.
Three.
So this is one simple example, and this can be achieved with the help of container orchestration.
Now, container orchestration can be used to perform a lot of tasks.
Some of them includes provisioning and deployment of containers among the virtual machines.
So let's say that you have 100 virtual machines and you want to deploy containers across them.
So it is very difficult for you to manually do that.
So container orchestration tool can easily do that.
Second is scaling up or removing the containers to spread the application load evenly.
Then you have moment of containers from one host to another if there is a shortage of resources.
So let's say a beam one has two containers.
However, the VM one has a very short resource.
There's only like 50 GB of RAM, which is available.
So what container orchestration tool can do is it can move the container from that VM one to a VM,
which is much more empty, which has much more better resource, which is available.
So that can be done with the help of container orchestration tool.
The container orchestration can also do load balancing and service discovery related features between
containers.
It can also do health monitoring of containers as well as the host.
Now, whenever you have a container orchestration, there can also be a lot of misconfigurations, which
can happen.
So let's say that you have defined a requirement in the container orchestration, which states that
a minimum of two web server containers should be running all the time.
Now, a container orchestration, what it might do, it can launch the two web server containers in
the same VM.
Although there are three VMs which are available, it launches the web server container in only one
VM.
And what happens here is that if both of them are in the same VM, first is there would be a resource
related issues if the production traffic increases.
Second is that this is not highly available.
If this VM itself goes down, then both of the container goes down.
So what you need to do is you need to have a good set of requirements and the container orchestration
tool also needs to be intelligent in such a way that if the container orchestration tool has a definition
that two Web servers should be running all the time, it should be intelligent to split the web server
container across the virtual machine so that the load is balanced as well as the high availability can
be taken care of.
Now, let me quickly give you one example of a container orchestration tool called X.
So X is the orchestration service specifically for us.
Now it has a feature of task placement.
Now, what task placement does is that.
Can use various constraints like availability zone or instance type to split the containers across virtual
machine.
So if you are familiar with us, let's say you have a virtual machine one and virtual machine two,
and both of them are within the same availability zone.
Now in such case, if you have web server container one in VM one and web server container two in VM
two, although it might be good in terms of load balancing, but in terms of fault tolerance, it is
not good because both of these VMs are within the same availability zone.
So you also need some kind of intelligence in such a way that a web server container should be split
across the instances in a different availability zone.
So if a single AC goes down, that should not affect your application.
So that is again, a great capability of ICS.
So coming back to the container orchestration solutions which are available, there are many container
orchestration solutions which are available in the market.
Some of them includes you have Docker Swarm, you have Kubernetes, which is one of the very popular
one in the industry.
You have Apache mixers.
You also have the elastic container service, which is a plus X.
Now, along with that, there are also various container orchestration platforms available like ICS.
So basically Kubernetes is if you might have worked, it is pretty complicated.
And handling Kubernetes is in a team of, let's say two or three DevOps can be a bit challenging specifically
if your environment is big.
So there are certain platforms like X, which is like a managed Kubernetes.
So it takes care of managing the Kubernetes and you take care of the rest.
So something similar to that is also available.
So let's do one thing before we conclude this video.
Let me quickly show you a quick demo related to the container orchestration, and we'll take the example
of Docker Swamp to understand on how exactly the container orchestration solutions help.
Now I'm in my class and if I do a Docker service LS you will see that I have one service called Hello
World, which is using the engine X image and it has a replica of one out of one.
So currently here the mode is replicated.
Now if I basically do a docker service, PS Helloworld, what it is basically showing was so earlier
what happened was there was this specific container, it got launched in a node or in a virtual machine
called Swarm zero two.
But due to some reason this virtual machine stopped responding.
And then what the orchestration tool did, it started this specific container in a different virtual
machine called this Form zero three.
So it has the capability to monitor whether the application or whether the container is running or not.
And if it is not running, then it will automatically start it in a different virtual machine, which
is available.
So this is very similar to what we were discussing.
Let's say that a web server container had stopped working in a VMM when then the orchestration tool
will automatically start the web server container in a different virtual machine.
So let's do one thing, let's try it out.
What we'll do is we'll log in to the swarm zero three server and will manually stop the container which
is running in the swarm zero three.
And then we'll look into whether the container orchestration tool here, in our case, Docker swarm,
whether it is able to detect that this specific container has stopped working and whether it launches
a new container yet again.
So let's try it out.
So I'm connected to this 103 machine where our service is running.
All right, so this is the service which is running.
And if you see the status is up.
So let's do one thing.
Let's stop the Docker daemon here.
All right.
So this is the worst case.
So it might happen that the server itself has stopped responding and it has shut down.
So now what happens?
So this is the application which was running here.
Now, since we had stopped the Docker service, then our application would have gone down.
But now let's run the same command, which is Docker service.
Hello World.
So after it detected that the container within the swarm zero three is not running, what it did was
it started the container in the swarm zero one node automatically.
And here if I do a docker piece, you should see that you have a container which is up and running and
this is from the engine X image.
So the container orchestration tool can automatically detect whether the container is up or not.
If it is not up, then it can either restart it or it can start that specific container in the different
node altogether.
So this is one capability of a container orchestration tool.
There are a lot of other capabilities.
But just to give you a gist, this is the demo that I decided to have with this specific video.
So this is it about the overview of container orchestration.
I hope this video has been informative for you and I look forward to see you in the next video.