0% found this document useful (0 votes)
19 views4 pages

Write Deployment Config For Our Applications - Transcript

Uploaded by

prasanthdusi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Write Deployment Config For Our Applications - Transcript

Uploaded by

prasanthdusi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Welcome back in this task.

We're going to have a look at writing our deployment files


for our two applications, getting them up and running.
And so let's go back over to our terminal here.
Let's firstly clear this here by typing clear and hitting,
enter. The last thing I want to do is make a new folder here
and we'll just call this ingress Cates and then we'll see
the internet.
Yes. And let's start with creating a new file.
Let's call it type in touch e appointments, dash a yellow.
Yeah. Yeah.
And let's try to encode here dot let's watch you open up our
visual studio code editor at this location.
Okay. Yeah, so we close this welcome screen here.
We have our deployment a dot.
Um Oh here, awesome.
Right, there is an extension uh that you can download for
kubernetes that helps us to actually craft these resource
files really, really easily.
But what we're gonna do is we're gonna write them up from
scratch and we can concentrate on each line.
I'm gonna try and get through it fairly easily uh fairly
quickly.
So the first thing we want to do is to type in the api
version.
I've gone into this in a lot more detail than my other course,
so we'll be doing it in that much detail here but we'll touch
over each of these these points here, so apps slash v one and
that's gonna be the api version of the syntax does differ.
So everything we're gonna do is kind and that's the kind of
object that we're creating here and there are several types.
This one is going to be a deployment metadata that's to do
with the data for each.
Thank you.
Hello, deployment itself.
And then this one is going to have an eight.
We'll call this first lap also back in line with the initial
properties here.
We're going to have this spec too long and so we're going to
invent that and this is the spec of the deployment itself.
So the first thing we need is replicas and that's going to be
how many replica pods are actually gonna be creative that
match the following template, which we're going to see in a
minute in this case is going to be three.
The next thing we're gonna need here is a selector.
We're going to invent it here.
We're gonna have a match labels, we'll see what this is for.
So inside of this, we're going to have a label to actually
match and what this is actually gonna do.
It's gonna allow our deployment anytime their deployments
actually run, it's going to operate on any pod That has the
following labels.
So we're just gonna keep it in kind.
We're gonna say at 1st dash app.
So all of our pods are going to have a label of um first app.
We're going to create that later.
Um so this doesn't give the positive labels.
This one says any time we're running a deployment with maybe
some new specification Match any pod that has a label at 1st
App. And that's because the selector is actually inside the
spec of the deployment itself.
Okay. Okay.
So now we have that in line back in line with selector here.
We need to tell it which template to actually use on the side
of template.
We're gonna have some meta data.
Yeah. And inside the meta data, we're going to have bagels.
So now we're talking about the metadata template, metadata
labels.
And they were talking about the labels for the actual pods
themselves.
So we're gonna give our What's the same label 1st lashed out.
That gives all the parts, this particular label.
Okay. Right.
Our pods needs some kind of respect themselves.
So again, here we have respect for the deployment and here we
have respect for the plot the pods themselves.
Yeah. Yeah.
Okay. That's gonna be containers.
But inside of this containers, we're gonna have a list.
The first one we're gonna give it a name.
So what we're actually gonna be using is this application
really helpful application you sometimes for testing
containers called http been Again, this is an arbitrary name
here, but the image itself, we can see the image that we're
actually gonna be using.
It's gonna be and just make sure the spelling is actually
right here.
So we want Kenneth rights slash h T T P. Yeah, that's the
name of the image that we're actually gonna be using.
We're gonna have a ports field here.
And the side of the ports?
We're gonna have another list.
Yeah, yeah.
And this is simply going to have inside of it a container
ports. Mhm.
He's written camel case here And then we can set this port
ourselves.
Okay. This case we just want to keep it to 80.
So what we're really telling um kubernetes here is to create
this container.
So here's the template for the pods and here's the spec so we
want containers and in this case we just want this particular
container and it's got a name and image and the ports field
the name.
We've named ourselves http.
B And that's fine.
The image is going to use this particular image to docker
image. And then this ports here is going to have a list in it.
In this case we just haven't contained important side of it.
And that's the Port 80.
And we're telling kubernetes expose the Port 80 on each pods
container.
That's going to be useful for us a little bit later.
So let's go ahead and type in control and save now let's jump
on back over to our terminal and make sure inside of the
ingress dash ks folder here, we're gonna get this up and
running.
So let's do a cube CTL live Chef and passing that particular
file deployment a that document.
And then we're gonna type in cube control.
Get pods.
I'm gonna give an option here crashed.
Oh, why they give us more information of the actual pods
themselves.
Um So if we just expand this here.
Okay, uh contain the creating Okay, and here we go.
First up and this three replicas.
What you got to look awesome.
Let's see if we do it again.
Yeah. So now this one is running is provided us with this
type. This one's still creating great stuff in a way that's
very similar to Dhaka.
We can actually get inside of our containers.
So we just copied the name of this container here.
Yeah. And instead of using the locker.
Exactly, could just use the cube CTL Exactly.
Ash I. T. Yeah, based in the name of the container itself
will go in as the shell.
Let's have a look here.
And now we can see we're actually inside the container here,
which is really good.
And let's have a look at what protesters are actually running
us aux.
We can see what the process is actually running here.
A sex isn't.
Mhm. And this G unicorn is actually running here on the local
host. We can see here.
So let's see if we can try and hit this.
If this applications are up and running now.
Um Do we have to get in here girl?
Maybe? Okay, so let's try and get curl installed here.
So what we want is to type at dash, get updates.
I was gonna pause it while this.
This completes.
That's all done.
And then we're gonna do an apt dash gets install.
Okay. The ball.
Yeah. Have yet to continue.
It's okay.
Mhm awesome.
So we now have colour so you can just curl on here, the local
host and slash first just call the local hopes to see what
response we get.
So we do get a response here, which is exactly what we're
looking for.
And if we do our a route again, you can have a look at the
documentation for the http being the application.
But one of the one of the routes that we can actually use is
this anything which you're gonna set up later?
It gives us back some information here, so that's actually
working now, so that's really good.
Um so the application is actually running a side of the
containers themselves so we can exit that.
Right. And we did say in the beginning that we want two sets
or two different applications running um so what we're gonna
do is copy that same configuration from our deployment over
to a second deployment, which is gonna create another three
sets of replica pods, which we then can have representing two
different applications inside of our cluster.
We can set them up under different services.
So let's go ahead and copy over our deployment file over to a
new one and we can simply use the cP command for that.
We can do deployment dash a dot.
Yeah more.
We can just do one, yellow and that will copy that over.
So let's open up the code, the game Actually where we have
code open here.
We don't need to do that now.
We have our deployment B We simply want to highlight the word
first here.
Control de control de we want that to be second dash app.
So we're changing it from first to second, is going to create
a new set of apps which is going to be three replicas.
It's going to install the same application here.
But we have different routes on the application which we're
gonna configure with our ingress.
So this will serve the purpose of having two different
applications so that everything else will stay the same.
So let's do control s to save, Go back over to our terminal
and this time we'll do a cube CTL applied dash f. We're gonna
do deployment, dash B. Yeah.
To get those sets up.
Yeah. And then we can simply try and get up pods again.
Keep CTL.
Okay, we can see three first steps and three second apps.
I'm actually running now.
These have just come up the last under 10 seconds ago.
Perfect.
So that's all done now.
We've got two applications running um will be at the same
application but we'll be able to configure different routes
within our ingress later.
Um So in the next task we actually need to go ahead and set
up our service is a service for each group of replica pods
and representing somewhat of an entry point to the different
applications or different routes on this application.
And so I look forward to seeing you there.

You might also like