Let's go to Tylenol here and let's create a new deployment.
By the way, now there are no deployments.
Okay, get deploy.
No deployments.
Gay get SVC services, no services, just a single one.
Kubernetes it is default one.
And now let's create new deployment based on custom built image.
For that, let's first utilize same command as we used before.
K Create deployment.
Let's name it.
K eight as web.
Hello.
And the next will be option.
Image and image will be this statute in my case.
Slash gay aids web.
Hello.
Same name as it appears here when I pushed this image to the Docker hub and the same name as I see here.
So here is my username and hero's name of the Docker repository.
Let's go ahead and create a deployment based on this image.
Of course, if you performed all the steps yourself and pushed custom built image to Docker Hub under
your account, you could utilize here your username.
So let's go ahead and create a new deployment.
Deployment was created.
Let's k get pods.
Now I see that container creating status is status of this port which was created for this deployment.
Let's check again.
Still container creating because it takes some time to pool image from Docker Hub.
And now I see that container is running great.
Here is the name of the container and here is hash of the replica set which was created by deployment.
And here is a specific hash for this particular port.
Now let's create service using cluster IP and try to connect afterwards to our web server, which is
running using Node.js Express.
So let's create a service for that.
We will expose Port K, expose deployment.
Here will be name of the deployment K eight as web.
Hello.
Next, let's add option port and recap that our express web server is running at Port 3000.
Let's go back to our application, go to index dot mj's file and here is this port 3000 and we could
basically expose it to the same external port that will be used for connections to deployment.
Let's utilize for that just single port we will not need for that target port option this way.
Let's add this dashpot equals sign 3000 like that and this will create cluster ip for deployment k eight
as web.
Hello.
Let's go ahead and create service.
Let's list services.
K get svc.
And here was newly created service.
Here was the name of the service and here was cluster IP which was created by Kubernetes.
And again, using such IP address, we will be able to connect to our deployment.
It means that you could connect to any of the ports you don't select which port you will be connected
to.
Kubernetes does this job for you.
And here we see that we opened port 3000, exposed port 3000.
Let's try to connect to this cluster IP and port 3000.
Let me copy this cluster IP and of course I will not be able to connect to this cluster IP from my local
computer.
That's why let's as usually quickly connect to our mini cube node as a sage docker at this IP.
59 one on one.
In your case, this IP is different here.
Our password is TSI user.
And now here let's see URL to cluster IP and port 3000.
That's that port which we exposed from deployment.
So let's go ahead and I see message.
Hello from the K eight.
S Web.
Hello.
And entire name of the server where express Node.js application is actually running.
And that's that message which comes from the Express website over here.
That's where we send it back to the client.
Hello.
From the and name hostname of the server where this application is running and it means that everything
works perfectly.
We created a deployment based on the custom built image which we pushed the Docker hub and here a result
of it and we see response from the web server application.
Wonderful.
By the way, if you enter a serial command like that, you will be automatically moved to the new prompt
and you will stay on this line.
If you want to move to the new line, you could enter a queue URL, then add the semicolon and add here
echo like that.
And now you will be moved to the new line here in the output.
Wonderful.
Now we got a response from the same port.
Here we see same hostname as we saw here.