We've now created a cluster IP service for the event bus and for posts.
Now it's time for us to wire it all up.
But what do I really mean by that step right there.
Well let's go back to our code editor I want to open up our post project once again and I just want
to give you a quick reminder about some code we wrote inside there.
So back inside my editor I will find the post project and the index dot ust file inside and then going
to scroll down a little bit to where we were creating a new post right after we created a post we then
made a request out to our event bus and remember to access our event bus we had to use a U R L of local
host four thousand five this exact you were all right here only worked correctly when we were running
the event bus on our local machine and not inside of say Cuban Eddy's communities right now technically
is on our local machine but you know what I mean we can no longer reach out to local host four thousand
five to get at our event bus we have to replace this URL with some new URL so what is that new you're
all going to be.
Well let's take a look at a diagram that's just going to give you a quick reminder on what our current
setup looks like.
So this is what we are doing right now.
We've got our pod propose pottery pottery bus and we've got a cluster I.P. service for each.
So we need to figure out how we're going to reach over and make a request to this cluster I.P. service
and hopefully that thing will forward the requests on to the event bus that we want to make a request
over to that cluster I.P. service.
What is the URL we are going to type in the URL that we're going to type in is going to be equal to
the name of that cluster I.P. service the exact name of that cluster IP service we can retrieve by going
back over to our terminal and do in a cube Seitel it services.
So the exact name is event butts SRB so if we want to reach out to the event bus SRB service we are
going to make a request to H TTP event bus s RV and that's it.
That's how we reach out from one pod to another service.
We just put in HDP than the exact name of the service we want to reach out to naturally if we are trying
to make a request to a very specific port.
We will add that on as well.
So our event bus service is listening for traffic on port four thousand five.
So we've put on colon four thousand five on the very end as well
the same exact thing is true if our event bus is trying to reach out to the cluster I.P. service that
is pointing at all of our postal pod.
So our service that's governing all those postal pods is post cluster IP SRB but this is both cluster
IP so if you want our event plus to reach out to that service it would make a request to
us cluster IP SRB and then the appropriate port which in this case is four thousand and so that would
be going from over here down to that service that's pretty much it so the takeaway here is that any
time they want to have some communication between pods we're always going to create a cluster IP service
for the pod we're trying to reach out to once we have created that cluster IP service to make a request
to it we're going to write in a URL of each GDP and add the name of the service to back on this diagram
when I said wire it all up I pretty much just mean we need to go around inside of our index dot j ust
file in the post project and any time we tried to reach out to our event bus we need to replace local
host with the name of the service or the event bus and the same is true of our event plus as well if
we open up our event bus indexed dot J.S. file remember inside of here we are trying to make requests
to local host 4000 so rather than putting local host right there we'll put the name of the service that
we are trying to reach out to look let's start making these changes in the next video after we make
these changes will then rebuild our images and update our deployments so that they are running this
new code.