As I mentioned before, it is not convenient to create separate pods inside of the Kubernetes cluster
because you are not able to scale and increase quantity of the ports.
Therefore, the most common way to create multiple ports when you are able to increase quantity of the
ports, decrease quantity, modify configuration, etc. is by using deployment and deployment will be
responsible for creation of the actual ports.
But please notice that all ports inside of the deployment will be the same, exactly the same.
But you could create multiple copies of the same port and distribute load across different nodes in
the Kubernetes cluster.
That's the purpose of the deployment.
Now let's go ahead and create deployment, and we will utilize same image which we utilized before.
It is engine image.
And also afterwards we will increase quantity of the ports in this deployment and also we will create
a service for this deployment in order to be able to connect to our deployment from external world.
Let's go ahead and create such deployment and for that we will utilize Command Cube, Ctrl create deployment.
We already alias the cube ctrl command.
That's why I will enter k create deployment and next will be the name of the deployment.
Let's name it Gen X and afterwards let us specify also image.
Similarly, as we did in cubes, it will run command and here after equal sign will be name of the image
we would like to utilize for this deployment.
And let's enter here again.
In order to avoid any confusion, let's modify the name of this deployment and let's name it, for instance,
and Gen does deployment like that.
Let's go ahead and create this deployment.
Deployment was created.
Let's enter command k get deployment.
Here was a single deployment.
It is ready and up to date and let's enter k get ports.
And now I see that there was no single boat which is managed by this particular deployment and such
a boat was created automatically after we created such deployment.
And now this boat is managed by this deployment.
There was just a single port at the moment.
And of course, the impossible to scale quantity of the ports and increase quantity of the ports, for
instance, to three, five and so on.
But first, before doing that, let's read details about such deployment.
And for that, let's enter command k describe deployment.
And here will be name of the deployment and deployment.
Here are details of creative deployment.
Let's scroll a bit up and here at the beginning of the output, I see name of the deployment and Gen-X
deployment.
That's that name which was given to this deployment by us.
Here was Name Space where our such deployment was created.
Default namespace.
Below you'll see that Kubernetes is automatically assigned labels to this particular deployment.
And there was just a single label up equals sign engine its deployment.
Also there are annotations again created automatically.
Here was annotation and here is also selector.
Selectors are used in order to connect ports with deployments because in Kubernetes both and deployments
are actually separate objects and we have to know how to assign specific ports to particular deployments.
And here we see selector app equals Sign and Jennings deployment and for particular port, which was
automatically created and assigned to this deployment.
We will find a label with the same value up equal sign and Jennings deployment.
We will have look at that just in a minute.
Also, there was a replica field and here you could find information about quantity of the ports which
are desired by this deployment and actual quantity of the ports which are running here with just a single
port, single replica which is desired one updated, one total and one available.
It means that now there was one port which is assigned to this deployment.
Here is also strategy type rolling update which tells how to perform updates of the deployments.
We will get back to it a bit later in this course.
And also below, you'll find other details about this particular deployment here.
You'll find also details about port template.
And as I just told you, you'll find out inside of the port corresponding label up equals sign and is
deployment.
And same label is mentioned here in the selector field in the deployment.
And that's how deployment is connected to particular ports.
Also, if you scroll a bit down, you'll find actual events related to this particular deployment.
And here we see single event scaling replica set.
But what is replica set?
A bit above you see new replica set and next deployment and ID of the replica set and replica set actually
manages all posts related to deployment and replica set is a set of replicas of your application because
you could create five or ten 100 different posts in the same deployment and all of them are included
in the replica set.
And that's why here you see that such replica set was scaled up to one and one.
What was created in this replica set?
Great this are details about this particular deployment.
And now let's have a look again at the list of the ports.
They get ports here with just a single port and notice its name.
It starts with the name of the replica set, which we just discussed.
And so in the output of the details of the deployment engine, its deployment and this hash and afterwards,
there was specific hash for this particular port.
And if there are multiple ports in the same deployment which belong to the same replica set, you'll
see same prefix here, but different hashes here for different ports.
Now there is just a single port which is ready and which is running.
Also, we could get details about this particular port.
Let's grab its name and enter here.
K describe.
Board.
And here let's paste copied hatch.
And here are the details about this particular pot.
Let's scroll up.
Here was the name of the board.
It matches with this name.
It was assigned to default namespace, same as deployment.
Here is Node where this particular port is running right now.
Here are labels of this particular port and I see such label as app and UNIX deployment and port template
has.
Notice that this hash is equal to this hash and it matches with ID of the replica set.
Also I see status running here was IP address of the port and here I see that it is controlled by specific
replica set, replica set and Jennings deployment and hero's hash of the replica set which controls
this particular port.
Also here are details about containers which are running inside of the port.
And here is container ID and image, which was used for creation of the container in this particular
port.
Also at the end, you could find logs related to the board, as we discussed before, successfully assigned
to specific node pulling image and and so on.
Now there was deployment and instead of the deployment there was replica set and ports are managed by
this deployment.
Now there was just a single port.