CARTER MORGAN: Today, it's time to figure out
how Kubernetes actually runs containers on nodes.
Let's check it out.
[MUSIC PLAYING]
With a whole universe of things to learn,
it's important to start with the essentials.
Let's go over the concepts that make
Kubernetes usable, scalable, and just downright awesome.
Are you ready?
So with all of our conversation about how
pods run in our containers, I figured
it would make sense to talk about nodes,
which means it's time to figure out, what are nodes?
KASLIN FIELDS: That's an important topic.
The simple way of looking at it is
that a node is a virtual or physical machine
that you run your workloads on.
CARTER MORGAN: Wow.
That's pretty straightforward.
And I know that in Kubernetes, we
operate on clusters, which are groups of one or more worker
nodes.
But in order to get the automation that Kubernetes
provides, I'm sure nodes are more than just
any old virtual or physical machine, right?
KASLIN FIELDS: Exactly.
Each node actually contains the services necessary to run pods.
A container runtime for running containers,
a kubelet for making sure that everything that
should be running is, and the kube-proxy
for handling networking.
CARTER MORGAN: Ah-ha.
So that's how Kubernetes keeps track of pods.
That also explains how pods get IP endpoints
and other necessary features for running at scale,
like being able to attach to a running pod for debugging.
KASLIN FIELDS: Yep.
Now, if we had to manually manage
all of the pods on each node, it would be impossible to handle.
That's one of the most important reasons Kubernetes exists.
The way Kubernetes actually manages
these pods is through what's called the control plane.
CARTER MORGAN: The control plane is
responsible for handling all of these details
by exposing an API.
This is where Kubernetes can define, deploy, and manage
the lifecycle of our pods.
KASLIN FIELDS: Right.
There's a lot going on in the control plane.
Let's look at some of the components
that make up the control plane and what they do.
First, there's the API server itself,
which handles data validation and configuration for all
of the API objects.
CARTER MORGAN: Next, there's etcd,
which is a key-value store for holding
onto all the important data that Kubernetes uses.
Plus, there's the Scheduler.
Here's where the important decisions
get made about where exactly a pod will run.
The Scheduler can look at the available resources for all
the nodes and make sure that a pod goes
to a node that can handle it.
KASLIN FIELDS: And don't forget about the Controller
Manager, where the core Kubernetes logic happens.
One of the big responsibilities here is lifecycle management,
to make sure all the various pieces are working correctly.
Similarly, there is the Cloud Controller Manager,
which lets Kubernetes hook into cloud providers.
So if you're running Google Kubernetes Engine,
the Cloud Controller Manager is what speaks to Google Cloud
when something is needed, like a new virtual machine for a node.
CARTER MORGAN: Having that abstraction from dealing
with the individual details of each cloud provider sure
sounds nice.
Wow.
The control plane is responsible for a lot.
But with all of that, how do you actually declare the details
to Kubernetes?
KASLIN FIELDS: That's where the Kubernetes API comes in.
Let's try it out in the next episode.
CARTER MORGAN: So that's how Kubernetes does all the things
that it does.
If you're going to deploy a container,
you'd make a pod that uses your container,
you'd make sure Kubernetes has nodes,
and then it figures out the rest.
KASLIN FIELDS: That's right.
The kubelets on the nodes are watching what's
going on on the node itself.
So when the control plane needs to schedule
a pod on that node, both the control plane and the node
itself have enough information to make sure it works.
CARTER MORGAN: Plus, if a pod runs into an issue,
the control plane will work with the kubelet
to remove the unhealthy pod and replace it with a new one.
Wow.
That was a lot of great info on nodes.
But now, it's time to take a deeper dive into the Kubernetes
API.
All right.
Stay tuned, everybody.
If you want to get hands-on, check out
the link in the description.
And if you enjoyed the episode, subscribe for more.
[MUSIC PLAYING]