Let's not try to create cluster IP for our deployment and we will create for that specific service.
So we already have deployment created.
Let's read the details about such deployment.
K get deployments.
By the way, you could shorten such a long road just to deploy like that gay get deployed.
And here was the name of our deployment.
Now there are three different ports which are ready in this deployment.
Let's now create a service for this particular deployment.
And using service, you could expose specific port from the deployment.
Now we are running three different ports and inside of each port there was engine x container and by
default, engine x web server is running at Port eight.
It means that we have to expose internal port eight from the containers to any other port outside of
the deployment.
And we could choose, for instance, port 88 for this particular example, in order to expose internal
port from the deployment ports, you should utilize command expose.
Let's enter a key expose deployment here will be name of the deployment.
We would like to create service form and index deployment here with the name of our deployment request
that we don't mention here.
Ports we work with, deployments and ports are managed by deployments.
So let's expose deployment engine is deployment here will be option port.
Let's specify a port which we would like to utilize as external port for our deployment.
And let's set it to Port 88.
And also we have to add here to port if port inside of the containers is different from this port,
which we specify right now here and in our example right now, port inside of the container is 80.
That's why we have to add here.
Option there's this target port equals sign eight.
So we expose internal port from the containers to external port 88 and we do that for the deployment.
Here was the name of the deployment.
All right, let's expose again.
Deployment service engine is deployment was exposed and now let's list services for that.
There was command k get services and now there are two services.
First, service is default system service.
It is called Kubernetes, type is cluster IP and here is cluster IP address.
And also here we see one more service engine is deployment.
Here was name here type cluster IP and here is cluster IP.
And this IP address is completely different from the IP addresses assigned to the puts.
This IP address is even from another network.
IP addresses of the ports start from 172.
And here this IP address starts from ten.
And this is a virtual IP address which was created by Kubernetes, and it is just a single IP address
which could be used in order to connect to any of the ports.
And such type glass tribe allows you to connect to specific deployment.
In our example, engine X deployment only from inside of the Kubernetes cluster.
For instance, if in your Kubernetes cluster there was database deployment, for instance, there was
MongoDB database or my SQL database, and such database should not be available and accessible from
outside world.
You could create cluster IP service for such database deployment and other deployments inside of your
Kubernetes cluster will be able to connect to database deployment using cluster IP.
But again, such deployment will be hidden from the outside world.
But on the other hand, if you create any Web service deployment and it should be available from outside.
Of course you have to expose it to outside world using node port or load balancer.
That's what we'll try a bit later.
Cluster IP will be available only inside of the cluster.
So here we see cluster IP address here what is and here is broad, which was exposed by our deployment.
Also, you could get a list of services using short version of this command.
Simply enter a k get svg.
See it is short version of services as we see and result will be the same.
There are now two different services with those cluster IP address, this one for Kubernetes service
and this one for engine deployment service.