title: RestTemplate exchange call gives 503 error when running in Docker container at Kubernetes environment
body: <p>My Spring Boot application runs fine when I run on the server as traditional way. 
  But, when I create a Docker image with this app and run the container at Kubernetes environment, I get "503 Service Unavailable" error back when the app makes RestTemplate call. </p>
  
  <p>Here is the code snipped where the call is made:</p>
  
  <pre><code>import org.springframework.core.ParameterizedTypeReference;
  import org.springframework.http.HttpEntity;
  import org.springframework.http.HttpHeaders;
  import org.springframework.http.HttpMethod;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.client.RestTemplate;
  
  ...
  
  private boolean isActiveUserExist(String userId, String password) {
  
      String restUrl = "http://10.3.0.176:8888/persons/application_id";
  
      HttpHeaders headers = new HttpHeaders();
      headers.add("Authorization", "Basic "+ Utils.base64Creds(userId, password));
      HttpEntity&lt;String&gt; request = new HttpEntity&lt;String&gt;(headers);
  
      //construct the URL with Request Parameters parameters    
      try {
        restUrl = restUrl + "?userId=" + java.net.URLEncoder.encode(userId, "UTF-8");
      } catch (UnsupportedEncodingException e) {
        log.error(e.getMessage());
        throw e;
      }
      restUrl = restUrl + "&amp;applicationPk=1"; //primarykey for this app
  
      log.debug("Rest URL to check user &lt;{}&gt;.", restUrl);
  
      RestTemplate restTemplate = new RestTemplate();
      ResponseEntity&lt;Person&gt; response = null;
  
      try{
  
        response = restTemplate.exchange(restUrl, HttpMethod.GET, request, 
            new ParameterizedTypeReference&lt;Person&gt;() {
        });
      } catch (Exception e) {
        log.error("Rest URL to check user returns error {}.", e.getMessage());
        throw e;
      }
  
      Person person = response.getBody();
      log.debug("isActiveUserExist({}) returns: {}",userId,person);
  
      return  ( person != null ) ;
  }    
  ...
  </code></pre>
  
  <p>Do you see any reason why RestTemplate.exchange call would not work and return 503 when it runs in the Docker Container at Kubernetes?</p>