<p>I am trying to use spring cloud gateway with kubernetes service discovery. Below is the setup which i am using</p>

<p><strong>build.gradle</strong></p>

<pre><code>plugins {
    id 'org.springframework.boot' version '2.2.0.BUILD-SNAPSHOT'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
    maven { url 'https://repo.spring.io/snapshot' }
}

ext {
    set('springCloudVersion', "Hoxton.BUILD-SNAPSHOT")
    set('springCloudKubernetesVersion', "1.0.3.RELEASE")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
    implementation 'org.springframework.cloud:spring-cloud-starter-kubernetes'
    implementation 'org.springframework.cloud:spring-cloud-starter-kubernetes-ribbon'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
        mavenBom "org.springframework.cloud:spring-cloud-kubernetes-dependencies:${springCloudKubernetesVersion}"
    }
}

test {
    useJUnitPlatform()
}
</code></pre>

<p><strong>application.yml</strong></p>

<pre><code>spring:
  application.name: gateway
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true
    kubernetes:
      reload:
        enabled: true
server:
  port: 8080
logging:
  level:
    org.springframework.cloud.gateway: TRACE
    org.springframework.cloud.loadbalancer: TRACE
management:
  endpoints:
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      enabled: true
    info:
      enabled: true
</code></pre>

<p><strong>DemoApplication.java</strong></p>

<pre><code>package com.example.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;

@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class DemoApplication {

    @Autowired
    private DiscoveryClient discoveryClient;
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @GetMapping("/services")
    public List&lt;String&gt; services() {
      return this.discoveryClient.getServices();
    }
}
</code></pre>

<p>Spring cloud gateway is not able to redirect the request to other services. The log being printed is</p>

<blockquote>
  <p>2019-10-13 18:29:38.303 TRACE 1 --- [or-http-epoll-2]
  o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {} 2019-10-13
  18:29:38.305 TRACE 1 --- [or-http-epoll-2]
  o.s.c.g.h.RoutePredicateHandlerMapping   : No RouteDefinition found
  for [Exchange: GET <a href="http://gateway-url/service-name/hello]" rel="nofollow noreferrer">http://gateway-url/service-name/hello]</a></p>
</blockquote>

<p>Although when I call <code>http://&lt;gateway-url&gt;/services</code>, then I can see the list of all services. So all the permission is being provided at pod level and service discovery is working fine. I am pretty sure there is some configuration, which i am missing but I am not able to figure it out even after looking at documentation several times.</p>

Nitishkumar Singh
<p>So, it looks like there is an issue in <strong>Spring Cloud Hoxton.M3 release</strong>, as it's working fine with <strong>Hoxton.M2</strong>.</p>

<p>I have opened an <a href="https://github.com/spring-cloud/spring-cloud-kubernetes/issues/479" rel="nofollow noreferrer">issue</a> for the same.</p>
