- [Instructor] At the end of the last section,
we had our application up and running in the web browser,
but let's go ahead and understand
what the basics of the application are
and how this interacts with the deployments and services.
So in order to do that, I'm going to go back
to my terminal window, and to understand
all the resources that Kubernetes has up and running,
you can run the Kubernetes command kubectl get all.
So this essentially returns all of the resources
that we have in the cluster.
So we notice that we have a pod running,
we have a couple of services, the deployment
that we had deployed, and the replica set as well.
So let's go ahead and look at some of these
in a little bit more detail to understand
what's going on behind the scenes.
I'm going to clear my screen, and what I'd like to do
is actually look at the deployment first.
And to do that, I can run the kubectl
get deployment command.
Instead of getting all resources,
I'm just limiting this to just the deployment.
So I can do that, and we'll notice
that we have a specific deployment here called hello world.
If I want to introspect into the hello world deployment,
I can do that by running kubectl get deployment/helloworld
and I'm going to output this as YAML.
And we notice that we have some YAML
that we can look at.
So this is the YAML of the live running deployment
that we have up and running right now.
It's API version 1.0, set up for kind deployment,
there's some metadata associated with this.
Scrolling down, we notice that there's
an API version once again.
It has name of hello world, it's deployed
to the default namespace, and the spec section
is the section you'll end up looking at a lot
when you're running with these deployments.
Over here we notice that we have a replica up and running,
selectors with some labels, where we have a match label
of hello world, a strategy for how we actually
rolled this out, and a template,
which actually contains your spec and your containers
where you signify what image you actually have.
So karthequian hello world is the image
that we actually have up and running.
Let's do the same thing for the service.
So I'll clear my screen.
I can run kubectl get service, and I'm going to introspect
into the hello world service here.
So kubectl get service/helloworld,
once again I'm going to output this as YAML,
and in fact, I'm going to clear my screen.
And it would be good to spell this correctly,
so let's do that.
Clear once again.
And here we notice that we have API version one,
it's kind service, metadata once again,
and in the spec section, this is where
we have cluster IP, the ports, including the node port
for 32124, it's linked to port 80
with a target port of 80, and we're using
the protocol of TCP.
So that's great.
Now in the last section, you noticed
that we deployed two artifacts,
the deployment, and then we deployed the service.
You'll want to make sure that you're looking
at your exercise files and you're in the 3_5 folder, like so
ls minus al, and PWD, so I'm running Kubernetes,
and then 03_05, because we'll want to take a look
at some of these YAML files that we have.
Initially what we deployed was just
the hello world YAML, so if I cat this file,
this is just the simple deployment.
And if we want to look at that again, ls minus al.
Let's take a look at the deployment file.
This is also very similar, and then we have
the service associated with that,
and the service, in this case, is in a YAML format.
So I can do a cat of hello world service,
and we notice that we have the spec section,
node port, followed by the protocol,
target port, and ports, et cetera.
So when we're running these, we can run
a kubectl create minus F hello world deployment.yml,
this will create the deployment.
Similarly I'm going to create the service.
Service YAML, so I've created a couple of resources,
so let's do get all.
Kubectl get all resources.
Here you'll notice we have a couple of pods running,
this is the one from before, you know 48 minutes,
this is the new hello world pod from the deployment,
it's running for 22 seconds.
We have a new service up there called
the hello world service, as well as a couple
of deployments now, one that was just deployed
22 seconds ago.
Now this can get a little tedious.
Notice that I typed in a couple of commands,
but there's a way to make this simpler.
So let's take a look at the YAML file
that we have in this folder.
Hello world dash all, and you'll notice here
that this looks exactly like what we had before,
in terms of we have the deployment,
and then we have this three dash notation,
and it looks like we have a service here.
Essentially the three dash notation
allows you to add multiple files into a single file,
so we can actually go ahead and execute
just one file to deploy all of your artifacts.
It makes life a little bit simpler
than having to run a lot of deploys for many files.
So I can run kubectl create minus F helloworld-all.yml.
And here we see we have a couple of things
that ended up getting created,
the deployment and the service.
Let's just look at the deployments.
We notice now that we have three deployments,
the hello world, this is the one we initially had,
hello world deployment that we just deployed
about two minutes ago, and then
the hello world all deployment.
Similarly, kubectl get services,
we have a few more services now,
the hello world that we did 50 minutes ago,
the hello world service that we did a couple
of minutes ago, and then the hello world all service.
All of these have different ports
that you can access these on,
because they're individual apps that are up and running,
because they're individual deployments.
But you get the gist that you can have
one single file to deploy many things
versus having multiple files to do one single thing.