504 Истечение времени ожидания шлюза для серверной части в оверлейной сети docker swarm

У меня есть рой из 3 узлов, работающий на openstack. В одной оверлейной сети работают 2 службы докеров. Один из них — частный репозиторий Nexus 3, а другой — обратный прокси-сервер nginx. Только nginx имеет открытые порты. Эта настройка работает нормально, но с перерывами (возможно, после многих часов отсутствия доступа) я получаю 504. Когда я попадаю в контейнер nginx...

нслукап:

root@7c7f5b09302f:/# nslookup nexus         
Server:     127.0.0.11
Address:    127.0.0.11#53

Non-authoritative answer:
Name:   nexus
Address: 10.0.0.6

wget:

root@7c7f5b09302f:/# wget -O- nexus:8081
--2017-05-09 23:23:18--  http://nexus:8081/
Resolving nexus (nexus)... 10.0.0.6
Connecting to nexus (nexus)|10.0.0.6|:8081... failed: Connection timed out.
Retrying.

--2017-05-09 23:25:26--  (try: 2)  http://nexus:8081/
Connecting to nexus (nexus)|10.0.0.6|:8081... ^C
root@7c7f5b09302f:/# 

пинг:

root@7c7f5b09302f:/# ping nexus
PING nexus (10.0.0.6): 56 data bytes
64 bytes from 10.0.0.6: icmp_seq=0 ttl=64 time=0.077 ms
64 bytes from 10.0.0.6: icmp_seq=1 ttl=64 time=0.098 ms
64 bytes from 10.0.0.6: icmp_seq=2 ttl=64 time=0.054 ms
64 bytes from 10.0.0.6: icmp_seq=3 ttl=64 time=0.071 ms
^C--- nexus ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.054/0.075/0.098/0.000 ms
root@7c7f5b09302f:/# 

Таким образом, он может найти адрес контейнера нексуса. Я могу пропинговать его, но не могу подключиться к порту 8081.

В самом контейнере нексуса (на другом узле роя) URL-адрес репозитория доступен, но из любого другого места я получаю ошибку 504:

bash-4.2$ curl -v http://nexus:8081/
* About to connect() to nexus port 8081 (#0)
*   Trying 10.0.0.6...
* Connected to nexus (10.0.0.6) port 8081 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: nexus:8081
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Tue, 09 May 2017 23:23:03 GMT
< Server: Nexus/3.1.0-04 (OSS)
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Content-Type: text/html
< Last-Modified: Tue, 09 May 2017 23:23:03 GMT
< Pragma: no-cache
< Cache-Control: post-check=0, pre-check=0
< Expires: 0
< Content-Length: 4659
< 

<!DOCTYPE html>
<html>
<head>
  <title>Nexus Repository Manager</title>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="description" content="Nexus Repository Manager"/>
  <meta http-equiv="X-UA-Compatible" content="IE=9"/>


  <!--[if lt IE 9]>
    <script>(new Image).src="http://nexus:8081/static/rapture/resources/favicon.ico?_v=3.1.0-04"</script>
  <![endif]-->
  <link rel="icon" type="image/png" href="http://nexus:8081/static/rapture/resources/favicon-32x32.png?_v=3.1.0-04" sizes="32x32">
  <link rel="mask-icon" href="http://nexus:8081/static/rapture/resources/safari-pinned-tab.svg?_v=3.1.0-04" color="#5bbad5">
  <link rel="icon" type="image/png" href="http://nexus:8081/static/rapture/resources/favicon-16x16.png?_v=3.1.0-04" sizes="16x16">
  <link rel="shortcut icon" href="http://nexus:8081/static/rapture/resources/favicon.ico?_v=3.1.0-04">
  <meta name="msapplication-TileImage" content="http://nexus:8081/static/rapture/resources/mstile-144x144.png?_v=3.1.0-04">
  <meta name="msapplication-TileColor" content="#00a300">



            <link rel="stylesheet" type="text/css" href="http://nexus:8081/static/rapture/resources/loading-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nexus:8081/static/rapture/resources/baseapp-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nexus:8081/static/rapture/resources/nexus-rapture-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nexus:8081/static/rapture/resources/nexus-proximanova-plugin-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nexus:8081/static/rapture/resources/nexus-coreui-plugin-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nexus:8081/static/rapture/resources/nexus-proui-plugin-prod.css?_v=3.1.0-04">

    <script type="text/javascript">
    function progressMessage(msg) {
      if (console && console.log) {
        console.log(msg);
      }
      document.getElementById('loading-msg').innerHTML=msg;
    }
  </script>
  </head>
<body class="x-border-box">

<div id="loading-mask"></div>
<div id="loading">
  <div id="loading-background">
    <img id="loading-logo" src="http://nexus:8081/static/rapture/resources/images/loading-logo.png?_v=3.1.0-04"/>
    <img id="loading-product" src="http://nexus:8081/static/rapture/resources/images/loading-product.png?_v=3.1.0-04"/>
    <div class="loading-indicator">
      <img id="loading-spinner" src="http://nexus:8081/static/rapture/resources/images/loading-spinner.gif?_v=3.1.0-04"/>
      <span id="loading-msg">Loading ...</span>
    </div>
  </div>

    <div id="code-load" class="x-hide-display">

                  <script type="text/javascript">progressMessage('Loading baseapp-prod.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/baseapp-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading extdirect-prod.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/extdirect-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading bootstrap.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/bootstrap.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading nexus-rapture-prod.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/nexus-rapture-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading nexus-coreui-plugin-prod.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/nexus-coreui-plugin-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading nexus-proui-plugin-prod.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/nexus-proui-plugin-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading app.js');</script>
              <script type="text/javascript" src="http://nexus:8081/static/rapture/app.js?_v=3.1.0-04"></script>

            <script type="text/javascript">progressMessage('Initializing ...');</script>
    </div>
</div>

<form id="history-form" class="x-hide-display">
  <input type="hidden" id="x-history-field"/>
  <iframe id="x-history-frame"></iframe>
</form>

</body>
</html>
* Connection #0 to host nexus left intact
bash-4.2$ 

Здесь я могу пропинговать контейнер nginx:

bash-4.2$ ping nginx_nexus
PING nginx_nexus (10.0.0.8) 56(84) bytes of data.
64 bytes from 10.0.0.8 (10.0.0.8): icmp_seq=1 ttl=64 time=0.089 ms
64 bytes from 10.0.0.8 (10.0.0.8): icmp_seq=2 ttl=64 time=0.066 ms
64 bytes from 10.0.0.8 (10.0.0.8): icmp_seq=3 ttl=64 time=0.047 ms
64 bytes from 10.0.0.8 (10.0.0.8): icmp_seq=4 ttl=64 time=0.076 ms
^C
--- nginx_nexus ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.047/0.069/0.089/0.017 ms
bash-4.2$ 

Примечание. До сих пор, когда я пытаюсь получить доступ к nexus через обратный прокси-сервер nginx из любой внешней точки, я получаю «504 Gateway Time-out». Однако в тот момент, когда я запускаю следующую команду в контейнере nexus, ошибка исчезает.

bash-4.2$ curl -v nginx_nexus
* About to connect() to nginx_nexus port 80 (#0)
*   Trying 10.0.0.8...
* Connected to nginx_nexus (10.0.0.8) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: nginx_nexus
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.13.0
< Date: Tue, 09 May 2017 23:33:44 GMT
< Content-Type: text/html
< Content-Length: 4681
< Connection: keep-alive
< Keep-Alive: timeout=5
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Last-Modified: Tue, 09 May 2017 23:33:44 GMT
< Pragma: no-cache
< Cache-Control: post-check=0, pre-check=0
< Expires: 0
< 

<!DOCTYPE html>
<html>
<head>
  <title>Nexus Repository Manager</title>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="description" content="Nexus Repository Manager"/>
  <meta http-equiv="X-UA-Compatible" content="IE=9"/>


  <!--[if lt IE 9]>
    <script>(new Image).src="http://nginx_nexus/static/rapture/resources/favicon.ico?_v=3.1.0-04"</script>
  <![endif]-->
  <link rel="icon" type="image/png" href="http://nginx_nexus/static/rapture/resources/favicon-32x32.png?_v=3.1.0-04" sizes="32x32">
  <link rel="mask-icon" href="http://nginx_nexus/static/rapture/resources/safari-pinned-tab.svg?_v=3.1.0-04" color="#5bbad5">
  <link rel="icon" type="image/png" href="http://nginx_nexus/static/rapture/resources/favicon-16x16.png?_v=3.1.0-04" sizes="16x16">
  <link rel="shortcut icon" href="http://nginx_nexus/static/rapture/resources/favicon.ico?_v=3.1.0-04">
  <meta name="msapplication-TileImage" content="http://nginx_nexus/static/rapture/resources/mstile-144x144.png?_v=3.1.0-04">
  <meta name="msapplication-TileColor" content="#00a300">



            <link rel="stylesheet" type="text/css" href="http://nginx_nexus/static/rapture/resources/loading-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nginx_nexus/static/rapture/resources/baseapp-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nginx_nexus/static/rapture/resources/nexus-rapture-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nginx_nexus/static/rapture/resources/nexus-proximanova-plugin-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nginx_nexus/static/rapture/resources/nexus-coreui-plugin-prod.css?_v=3.1.0-04">
            <link rel="stylesheet" type="text/css" href="http://nginx_nexus/static/rapture/resources/nexus-proui-plugin-prod.css?_v=3.1.0-04">

    <script type="text/javascript">
    function progressMessage(msg) {
      if (console && console.log) {
        console.log(msg);
      }
      document.getElementById('loading-msg').innerHTML=msg;
    }
  </script>
  </head>
<body class="x-border-box">

<div id="loading-mask"></div>
<div id="loading">
  <div id="loading-background">
    <img id="loading-logo" src="http://nginx_nexus/static/rapture/resources/images/loading-logo.png?_v=3.1.0-04"/>
    <img id="loading-product" src="http://nginx_nexus/static/rapture/resources/images/loading-product.png?_v=3.1.0-04"/>
    <div class="loading-indicator">
      <img id="loading-spinner" src="http://nginx_nexus/static/rapture/resources/images/loading-spinner.gif?_v=3.1.0-04"/>
      <span id="loading-msg">Loading ...</span>
    </div>
  </div>

    <div id="code-load" class="x-hide-display">

                  <script type="text/javascript">progressMessage('Loading baseapp-prod.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/baseapp-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading extdirect-prod.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/extdirect-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading bootstrap.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/bootstrap.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading nexus-rapture-prod.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/nexus-rapture-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading nexus-coreui-plugin-prod.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/nexus-coreui-plugin-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading nexus-proui-plugin-prod.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/nexus-proui-plugin-prod.js?_v=3.1.0-04"></script>
                  <script type="text/javascript">progressMessage('Loading app.js');</script>
              <script type="text/javascript" src="http://nginx_nexus/static/rapture/app.js?_v=3.1.0-04"></script>

            <script type="text/javascript">progressMessage('Initializing ...');</script>
    </div>
</div>

<form id="history-form" class="x-hide-display">
  <input type="hidden" id="x-history-field"/>
  <iframe id="x-history-frame"></iframe>
</form>

</body>
</html>
* Connection #0 to host nginx_nexus left intact
bash-4.2$ 

Это продолжает происходить с перерывами. Через несколько часов, когда репозиторий не используется, я снова обнаружу «504 Gateway Time-out», и мне придется войти в узел swarm и контейнер nexus и снова запустить curl, чтобы решить эту проблему. Помогите, пожалуйста, найти решение ошибки 504. Эта проблема не возникает, если контейнеры работают на одном хосте и не используется оверлейная сеть.


person Anu    schedule 09.05.2017    source источник
comment
Нашли ли вы какое-либо жизнеспособное решение этой проблемы?   -  person simdrouin    schedule 06.07.2017
comment
Проблема исчезла с обновлением openstack. У меня больше нет сведений о версии или настройке, поэтому я не могу предоставить дополнительную информацию об этом.   -  person Anu    schedule 07.07.2017


Ответы (1)


Проблема исчезла с обновлением openstack. У меня больше нет сведений о версии или настройке, поэтому я не могу предоставить дополнительную информацию об этом.

person Anu    schedule 07.07.2017