<p>I have this method to get userinfo. I know that if I use a valid url 
<code>(i.e. http://url.to.access)</code></p>

<p>my <code>getuserinfo()</code> is working.</p>

<p>Is there a way for me to use the kubernetes service name to call a GET request with my speing boot application? 
<code>(i.e. &lt;pod-name&gt;.&lt;namespace&gt;.svc)</code></p>

<p><code>userInfoUrl</code> comes from property.yaml:</p>

<pre><code>  @Value("${auth.userinfoUrl}")
  private String userInfoUrl;
</code></pre>

<p>Method to get userinfo:</p>

<pre><code> public ResponseEntity&lt;String&gt; getUserInfo(String accessToken) {

    if (!StringUtils.hasText(accessToken)) {
      throw new InvalidAccessTokenException("Invalid accessToken.");
    }

    // Set authorization header with access token
    HttpHeaders headers = new HttpHeaders();
    headers.set("Authorization", "Bearer " + accessToken);

    HttpEntity&lt;String&gt; entity = new HttpEntity&lt;&gt;(headers);

    // Does url param tagging based on param given.
    UriComponentsBuilder builder =
        UriComponentsBuilder.fromHttpUrl(userInfoUrl);

    // Call auth server to get user info.
    return restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
  }
</code></pre>

shadow
<p>Create a ClusterIP type <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/" rel="nofollow noreferrer">service</a> in-front of the pods responsible for userinfo application. Then you can either use <code>servicename.namespacename.svc.cluster.local</code> from any namespace or just <code>servicename</code> from same namespace to access it in the spring boot application.</p>
