- [Instructor] One of the most common questions
that people ask is how do I deploy Kubernetes to production?
Previously it was difficult to deploy Kubernetes
to a production environment.
In the container community, it was well-known
that Kubernetes is a great tool,
but at the time was almost impossible to deploy and manage.
Fortunately with the growth of Kubernetes and its community,
a lot of work has been performed in this space,
and it's much easier to deploy Kubernetes today.
So let's take a look
at some of the most common ways to install Kubernetes.
If you're a Dev/Ops engineer
tasked with getting Kubernetes to production,
I would highly recommend running through
Kelsey Hightower's "Kubernetes the Hard Way" tutorial.
It documents in detail all the components
that need to be installed to get it running
and avoids any scripts.
This is really useful so that once something does break
in your production environment,
you know what the components are, and more importantly,
you know how to react.
The most common way to install Kubernetes today
is using the Kube admin tool, also known as kubeadm.
This is probably the easiest way to install it
on any public cloud, private cloud,
or on premise infrastructure.
Essentially, you're required to initially provision
the master host with Docker and the Kubernetes distribution
you're looking for.
Once this is done, you can run kubeadm init,
which starts up Kube admin and provisions the control plane.
Once completed, Kube admin will provide you with a token
called a join token.
On each of your worker nodes, you can simply run
the Kube admin join command with your join token,
and the workers will join your cluster.
Once the nodes have joined, you'll need to install
a pod network for your pods to be able to communicate
with each other.
There are many different networking solutions
that you can implement which have different pros and cons
depending on your infrastructure needs.
However Flannel and Weave Net are a great place to start.
I've included additional networking resources
in the handout provided in the exercise files,
so take a look.
Kops, if you're working in an AWS infrastructure
and you're wanting to install a cluster,
then kops is the tool for you.
Kops has a number of useful features.
It automates the Kubernetes cluster provisioning in AWS.
It deploys highly-available masters,
also known as HA.
It permits upgrading with kube-up,
uses a state-sync model for dry runs
and automatic idempotency.
It generates configuration files for AWS CloudFormation
and Terraform configuration,
supports custom add-ons,
and finally uses a manifest-based API configuration.
Kops is a very popular way to deploy Kubernetes on AWS
and looks very similar to the way kubectl operates.
If you're going to run Kubernetes on a cloud provider
like AWS, Azure, Google or Oracle Cloud,
you might want to consider
one of their native container services
like Amazon Elastic Kubernetes Service on AWS,
Azure Container Service for Azure,
Google Container Engine for Google Cloud
or Oracle Container Engine for Kubernetes in Oracle Cloud.
Now you might ask, why am I wasting time
using kube admin or kops
when I can just use a managed service?
This is a really good question.
For those folks working in the cloud,
managed Kubernetes services have become very popular.
You spend a lot less time
managing the Kubernetes control plane
and spend more time on the applications
deployed in your data plane.
However, providers don't let you configure
all the different elements of Kubernetes
that you may need
and might trail the latest Kubernetes version as well.
So my recommendation is this.
If you're running Kubernetes in the cloud,
start with a managed Kubernetes service
because it reduces overhead
of managing the Kubernetes control plane.
If you realize that there are other Kubernetes features
your applications might require that are not provided
by the managed service,
then perhaps roll your own installation.
If the managed service fits your use case,
I'd highly recommend using it versus rolling your own.
A Kubernetes install isn't as hard as it used to be
with the advent of new tools like kube admin, kops
and managed services on cloud providers
doing all the heavy lifting for you.
Getting a cluster up and running today is quick,
and building a production-worthy platform
isn't as hard as it used to be.