<p>I am learning Spring boot kubernetes and trying to setup spring cloud gateway for my services. I believe with Spring cloud gateway we don;t have to use ribbon for load balancing any more. So If I don;t use ribbon then the configuration for routes changes as well. I looked over the sites for suggestion and following is what I found :-</p>
<pre><code>routes:
- id: department_route
  uri: http://departmentservice:4200 # 
  predicates:
  - Path=/* 
</code></pre>
<p>In this case the uri has a hardcoded value of port at which the service is available. Is this is recommended approach ?</p>
<p>And then there is another flavor of the configuration which looks like this and Not sure what url-expression trying to do :-</p>
<pre><code>spring:
  application.name: gateway
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true
          url-expression: &quot;'http://'+serviceId&quot;
  server.port: 8080
</code></pre>
<p>Is it not possible to do a service discovery by name and append the predicate after that?</p>

James Stan
<p>I am Still working on fixing the Spring Cloud Gateway project of main but following has worked for me. I have configured the routes via Zuul so make sure your dependencies and configuration related to it matches :-</p>
<pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;spring-cloud-starter-netflix-zuul&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;spring-cloud-starter-kubernetes-all&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;spring-cloud-starter-sleuth&lt;/artifactId&gt;
    &lt;/dependency&gt;

**Config :: application.yaml ::**

    zuul:
      routes:
        shopping-cart-service:
          path: &quot;/shopping-cart-service/**&quot;
        item-service:
          path: &quot;/item-service/**&quot; 
</code></pre>
