We've now fixed up posts and the react application.
So let's go and write out our routing configuration inside of our ingress controller.
Now that we have all these unique routes but together.
So I'm going to find inside of my infra K AIDS directory the ingress service I can find where we have
path's list out right here.
We're going to start to update this pad and update or add in a couple of additional parts as well.
So first off as we just discussed requests coming in to create a post so one that is trying to go to
the post odd is now going to have a path of post slash create.
Then after that I'm going to add in another path.
So this one will be for let's skip on to just slash post right here.
Request comes in slash posts.
We want to send it to the query Khaled my path will be slash posts.
In that case the back end is going to be the service that is named wary SRB.
Now let's get a quick reminder on what port that query service is running on.
We can either print out all of our services at the terminal or alternatively we can just open up our
posts dash depot file right there.
So here's the url not post but query Here's the query service.
Looks like it's 44000 to so a service port 4000 to.
Next up we have a path of post slash I.D. slash comments.
Now we are writing out some running configuration that's going to be interpreted by engine X right now
and engine X does not support the same kind of like wildcard thing right.
They're using a colon.
Instead we write up parts and if we ever expect to have some kind of wild card inside of it we have
to use a regular expression.
So we are going to write out a path of slash both slash and here's our regular expression part question
mark parentheses dot star.
Like so and then slash comments so this is going to be a wild card.
We can have any value what we want to have inside there as long as it is followed by slash comments
at the very end.
It's going to match up to this Pat in order to use regular expressions in a path right here.
We do have to add in one additional line of configuration at the top of this file so I can scroll back
up towards the top.
I'm gonna find that annotation section instead of here.
I'll add in one more annotation of engine X thought cougar net is next to me.
Engine X ingress.
There we go.
Dot Coober net is that I O slash use dash rig x output in true inside of a string.
Notice that there are quotes around us so it is not just true by itself it is true with a set of single
quotes around it.
So again that's going to allow us to use regular expressions in all of our path expressions.
Now we've got that but together we can specify our back end this will be a service name in this case
or this path.
We want to reach out to our comments pod so common spot right here.
We'll make sure that we specify the comments.
Service comments dash SRB the service port for that.
I do not recall off the top of my head.
I'm gonna go and double check my comments dash depot file.
Here's the comment service it is watching for traffic on port four thousand one it's all put in my service
port a four thousand one right there and then finally our very last path will be just slashed by itself.
Now for our ReACT application just flashed by itself would work OK but for a typical react application
where you are using something like react router to handle routing around inside of your application
in a single page app sort of approach you would usually use a query or me a rig X right here of dot
star like so that's can make sure it matches any path and always tried to show the react application.
Now if you're going to write out a path like this it always has to be at the very end.
These paths are ordered from greatest importance down to the least importance so if we put this at the
end it will match only after trying to match all these other parts.
If we put this at the top it will always go to the react app no matter what.
Which is not what we want so then I'll put in my backend with the service name of client SRB and a service
port of three thousand.
All right.
I'm gonna say this I'm going to go backwards my terminal I'm inside of my k aides directory we're going
to make sure that we reapply the ingress SRB file so it keeps GTL apply dash f ingress Dash.
S R v dot AML.
Looks like we've updated our configuration successfully.
So now we are ready to do a big final test and make sure our application is working before we do I can
do a quick QCT l get pods I'm going to verify that everything is up and running.
If you have any errors you'll need to make sure that those get result before we do this final test.
I can go back over to my browser.
I'm gonna go to post dot com and I should see might react application here.
Yep here it is.
You might see one or two posts already listed inside of here.
If you do that is because we created some post a little bit ago using post man.
I deleted those posts just so I'd have a fresh slate right here.
I'm gonna create a brand new post so say new post number one.
Remember we don't have any kind of library load or anything like that looking to refresh the page and
there's my post.
Very good.
And then of course you have to test out our comments as well.
I'll put a new comment submitted refresh and there's my comment.
Hey that's it.
Well that is a lot of work but after all this work we've now got our application posted inside of a
Cuban 80s cluster.
Of course we're not quite done yet.
As I mentioned in the last video right now any time that we want to make a change to our code base we
have to make the change we have to rebuild the image we have to push the image up to Docker Hub and
then run that you'd see to yell the rollout restart deployment blah blah blah.
Commands and obviously that is way too involved for doing any type of typical development approach.
So we definitely need a better way of making changes to our cluster inside of a development environment
than what we have right now.
As I mentioned there is a tool that we're going to use to automate a ton of the stuff that we've been
doing in these last videos.
We'll take a pause right here and start to take a look at that tool in just a moment.