In this video we are going to talk about
the importance of docker and kubernetes
in a data science workflow and why
organization embracing AI should use it
now docker is a popular container
environment and kubernetes and is a
platform for orchestrating docker or
other containers. Docker allows
application to be packaged in a
self-contained environment which makes
it easy to deploy as well as it brings
parity between your development
environment and deployment environment.
Kubernetes on the other hand automates
all your networking security and another
aspect of container management and more
importantly provides a mechanism to
scale your container rapidly.Kubernetes
and docker are pretty important in your
machine learning lifecycle mode from
development and deployment aspect as it
makes your entire workflow simple
consistent and scalable .We will now
discuss the three major area where
kubernetes can be beneficial in the data
science workflow. The first one is
infrastructure. Now infrastructure is a key investment
in any data science initiative.Enterprise
typically invest in
high-performance system or GPUs to
accelerate a data science initiative.
If you really see the usage pattern of
this infrastructure typically when the
model training or the model hypothesis
phase is going on, the usage is pretty
high but once the model development is
completed the interest is pretty
much idle.What Kubernetes allows is, it
brings in a mechanism to efficiently
share resources and enable multi-tenancy. So what this means is, that can be
multiple AI project within the
infrastructure within the organization
that can use the same infrastructure, at
the same time have their bare minimum
required quota that is required to run
their model. So basically you are
utilizing your infrastructure in a
better and efficient way and at the same
time you get better ROI on your
infrastructure investment. The second
benefit is tooling and reproducibility. If you see today's data science workflow we
use numerous tools it can be tensor flow,
it can be pytorch, it can be
scikit-learn, it can be R and each of
this specific version of the tool like
tensorflow 2.0 or tensorflow 1.6 as its
own set of dependencies with numpy,
pandas and other ecosystem component. It
becomes very difficult to manage in an hard
wired infrastructure to have this
multiple version deploy together and
maintain multiple conda environment.
So with multi-tenancy one more benefit
that containers bring in is basically
you can package all the dependencies per
project in your own container
environment. Basically you're creating a
virtualized environment with all
dependencies packaged in, that your
specific use case can use and similarly
other use case can add their own
dependency bundled together .Now what
this also brings in is reproducibility.
So, basically once your model is
developed you just pass on the container
to the software engineer to deploy it
with all dependency in it rather than
sending a big instruction manual on 
what to install and how to deploy. This
makes your production and your
development environment highly
reproducible and consistent.The final
benefit is a deployment and scaling. If
you see an end to end pipeline,
basically the training pipeline is
nothing but a mechanism to collect data,
pre-processed data, feature engineer and
then train the model and once the model
is trained basically you save the model
and then in your deployment 
pipeline you need to kind of replicate
the entire workflow of data collection,
data pre-processing, future engineering
and you kind of load the saved model in
a serving function and then you kind of
inference on it. Now what you can do is, 
this serving function can be an regular
flask app that loads  that
kind of calls all the pre-processing
pipeline and loads the model right, and
what you can do is this flask app you
can basically instruct in a docker file
while deployment to start the flask app and
keep it up and running for
serving incoming requests. One of the key
benefit of kubernetes over here
the scaling right now your application
might have peak volume during the
weekend or during the day hours and
pretty less volume during the night time. So what you can do is basically you can
instruct your kubernetes to auto scale
your model container during the peak
hours and weekend and then run on
minimum capacity during the night hours.
Tthis way you are bringing
efficiency in your infrastructure
utilization.You can also build
deployment strategies like Bluegreen
deployment, cannery deployment, or ab
deployment right like you may have a
champion model and a challenger model
and you want to instruct like okay fifty
percent of the volume goes to my
champion model and fifty percent of my
volume goes to my challenger model all
this is seamlessly possible with
kubernetes in place
