 This video we are going to be looking at setting up the gateway. This is a spring cloud gateway instance as a service and deployment inside of Kubernetes. Again, this is going to be mimicking some type of Kubernetes ingress. We covered that in the previous video about what all that means, but here we want to go in and configure this. So let's take a quick look at the gateway configuration. I'm doing it through Java. And a couple different ways that we can configure spring cloud gateway. Here we can see we have routes, IDs, creatively named beer service, inventory service, and order service. And you can see here this is mapping to an HTTP route. So beer service goes to host beer service 8080. Inventory goes to inventory service 8082. And then finally order service 8081. So these are things that are being mapped in the gateway controller. And then those host names, those are going to be managed by Kubernetes enabling our service lookup to find out where those services are through the host name. And then our traffic will be routed there through the spring cloud gateway. So this is configuration. What's important is that Kubernetes is able to resolve beer service, inventory service, and order service. So we've already done that configuration. What we need to do now is go ahead and set this up. You can see here from the Docker compose definition for this pretty straightforward. All we're doing is exposing port 9090. And other than that, there's nothing for us to be concerned with as far as a deployment under Kubernetes. So I'm going to toggle over to the command line now. And here what we want to do is set up the deployment. Simply going to call it gateway KBE brewery gateway. We need the dry run dry run equals client minus oh for YAML output. And we will redirect that to gateway gateway deployment dot YAML. And we can do kube ttl ply minus f gateway deployment. And this is going to create the deployment the pod for the gateway service. And then we also need to do control create service. And here we're going to say node port. We'll call this a gateway. And again, we want the dry run option minus oh for YAML output. And we are going to redirect the output of this command to the file gateway. And of course we want to apply that. So we're going to say kube control apply gateway service. That's that set up. And here we can see that we are definitely getting a lot more going on in this. So here we can see the pods that have been set up. So we have our beer service gateway, inventory failover, inventory service, JMS, MySQL, and order service. So all this is up and running it. Just glancing at everything. Everything looks like it's running normally. And we can see gateway. So internal to the cluster the gateway is running on 9090, but on localhost it's on 30499. Or 30499, I am going to just copy that value. And what we can do is we can come over to postman now and go ahead and paste that in. So we can see localhost 30499. That is the port, the node port that's been exposed by Kubernetes. And that is for the gateway. And we can see that I am now getting the proper response. So you can see I'm getting beers back from the beer service. So what this means is that just to help you visualize this. So we are going to localhost 30499. This is going through toggleback or the command line. So the gateway service is listening on localhost 30499. And Kubernetes is routing that request to the gateway service. The gateway service is routing the traffic to the beer service. So we are going through the gateway to the beer service that is running on port 8080. And this all abstracted by Spring Cloud Gateway and Kubernetes. Kubernetes is assigning. You can see here. We don't need to know that the beer service is running on this internal IP of 10101, 152, 102. Kubernetes is handling all that. And the traffic is going through the localhost port 30499. And then Kubernetes is routing that to the gateway service. The gateway service has a reference to the beer service. And the beer service is handled by the Kubernetes networking to get the request to this pod that is running here. So very important to remember that localhost is running on the network of my localhost. And this IP technically is unreachable without doing some special commands. But this is effectively unreachable for us from the localhost network. We are going into the Kubernetes network. And Kubernetes is managing and routing all that traffic. So things are getting routed in and out of our service. And we can see that it's working properly. Let's toggle back over to Postman. And we can see that the performance is actually fairly decent. As far as getting that request in and out of the beer service. So I toggle back over to IntelliJ. We used the Kubernetes command line cube control to create two files here. And we didn't have to modify them at all because what we're doing is we're setting up the brewery gateway. We created the deployment. This was generated from the command line. We did not have to modify that at all. And really all we're saying is that we are using this image. The configuration has already been done. It is hard coded effectively. Not necessarily something that we always want to do. There's a way to do configuration parameters with Spring Cloud Gateway. I'm not going to get into that at this point in time. But that is hard coded to go to those service names. And then also we set up the service. And the important thing here is that the service has been defined as a type of node port. So node port is going to expose that service on a randomly assigned port by Kubernetes. And when I come back to the command line, I do cube control get all. When we do cube control get all, if I look at the gateway service, I can see that it is a node port. And the port on the local host has been 30499 has been mapped to the port 9090, which the gateway service is listening to on the Kubernetes internal network.