web-dev-qa-db-ja.com

cloud-initがメタデータサーバーを見つけられない(Openstack)

サーバーがメタデータサーバーへの接続に失敗している(そのため、SSHキーでログインできない)理由を理解しようとしています。

オンラインでの同様の問題は セキュリティグループの問題 が原因であるようですが、ここでは問題ではないと確信しています。

これは、IPが192.168.160.100の単一のホストです。ゲストには10.225.134.63の固定IPが与えられます。ネットワークの10.225.134.64にneutron DHCPサーバーがあります。

ホストでは、次のコマンドを実行しました。

# curl http://192.168.160.100:8775
1.0
...
2008-09-01
2009-04-04

# curl http://169.254.169.254
curl: (7) Failed connect to 169.254.169.254:80; No route to Host

/ etc/neutron/metadata_agent.ini

nova_metadata_ip = 192.168.160.100

/ etc/nova/nova.conf

metadata_Host=192.168.160.100

起動ログ

cloud-init[827]: Cloud-init v. 0.7.5 running 'init' at Fri, 29 Sep 2017 09:50:08 +0000. Up 6.40 seconds.
cloud-init[827]: ci-info: +++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++
cloud-init[827]: ci-info: +--------+------+---------------+---------------+-------------------+
cloud-init[827]: ci-info: | Device |  Up  |    Address    |      Mask     |     Hw-Address    |
cloud-init[827]: ci-info: +--------+------+---------------+---------------+-------------------+
cloud-init[827]: ci-info: |  lo:   | True |   127.0.0.1   |   255.0.0.0   |         .         |
cloud-init[827]: ci-info: | eth0:  | True | 10.225.134.63 | 255.255.240.0 | fa:16:3e:0b:36:43 |
cloud-init[827]: ci-info: +--------+------+---------------+---------------+-------------------+
cloud-init[827]: ci-info: ++++++++++++++++++++++++++++++++Route info+++++++++++++++++++++++++++++++++
cloud-init[827]: ci-info: +-------+--------------+--------------+---------------+-----------+-------+
cloud-init[827]: ci-info: | Route | Destination  |   Gateway    |    Genmask    | Interface | Flags |
cloud-init[827]: ci-info: +-------+--------------+--------------+---------------+-----------+-------+
cloud-init[827]: ci-info: |   0   |   0.0.0.0    | 10.225.128.1 |    0.0.0.0    |    eth0   |   UG  |
cloud-init[827]: ci-info: |   1   | 10.225.128.0 |   0.0.0.0    | 255.255.240.0 |    eth0   |   U   |
cloud-init[827]: ci-info: +-------+--------------+--------------+---------------+-----------+-------+

cloud-init[827]: url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [50/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
cloud-init[827]: url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [101/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
cloud-init[827]: url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [119/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
cloud-init[827]: DataSourceEc2.py[CRITICAL]: Giving up on md from ['http://169.254.169.254/2009-04-04/meta-data/instance-id'] after 120 seconds
cloud-init[827]: url_helper.py[WARNING]: Calling 'http://10.225.134.64//latest/meta-data/instance-id' failed [0/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
cloud-init[827]: url_helper.py[WARNING]: Calling 'http://10.225.134.64//latest/meta-data/instance-id' failed [1/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
cloud-init[827]: url_helper.py[WARNING]: Calling 'http://10.225.134.64//latest/meta-data/instance-id' failed [2/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
...
cloud-init[827]: url_helper.py[WARNING]: Calling 'http://10.225.134.64//latest/meta-data/instance-id' failed [119/120s]: unexpected error ['NoneType' object has no attribute 'status_code']
cloud-init[827]: DataSourceCloudStack.py[CRITICAL]: Giving up on waiting for the metadata from   ['http://10.225.134.64//latest/meta-data/instance-id'] after 126 seconds
2
Mark Perryman

私も同じ問題に直面したため、インスタンスを再起動しようとしましたが、しばらくするとRoute Ipv4情報で、インスタンスがメタデータを取得しようとしている3番目の宛先を識別できます。これは問題の正確な解決策ではなく、一種の代替策です。

[ 131.326590] cloud-init[548]: Cloud-init v. 18.4-0ubuntu1~16.04.2 running 'init' at Thu, 29 Nov 2018 13:01:17 +0000. Up 104.95 seconds. [ 131.373908] cloud-init[548]: ci-info: +++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++++ [ 131.398661] cloud-init[548]: ci-info: +--------+-------+------------------------------+---------------+--------+-------------------+ [ 131.419546] cloud-init[548]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address | [ 131.515524] cloud-init[548]: ci-info: +--------+-------+------------------------------+---------------+--------+-------------------+ [ 131.567586] cloud-init[548]: ci-info: | ens3 | True | 20.0.0.9 | 255.255.255.0 | global | fa:16:3e:fb:ba:81 | [ 131.595173] cloud-init[548]: ci-info: | ens3 | True | fe80::f816:3eff:fefb:ba81/64 | . | link | fa:16:3e:fb:ba:81 | [ 131.621358] cloud-init[548]: ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | Host | . | [ 131.652707] cloud-init[548]: ci-info: | lo | True | ::1/128 | . | Host | . | [ 131.681617] cloud-init[548]: ci-info: | sit0 | False | . | . | . | . | [ 131.716687] cloud-init[548]: ci-info: | tunl0 | False | . | . | . | . | [ 131.747621] cloud-init[548]: ci-info: +--------+-------+------------------------------+---------------+--------+-------------------+ [ 131.828146] cloud-init[548]: ci-info: ++++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++++ [ 131.891154] cloud-init[548]: ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ [ 131.912601] cloud-init[548]: ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags | [ 131.935481] cloud-init[548]: ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ [ 131.981100] cloud-init[548]: ci-info: | 0 | 0.0.0.0 | 20.0.0.1 | 0.0.0.0 | ens3 | UG | [ 132.029476] cloud-init[548]: ci-info: | 1 | 20.0.0.0 | 0.0.0.0 | 255.255.255.0 | ens3 | U | [ 132.058772] cloud-init[548]: ci-info: | 2 | 169.254.169.254 | 20.0.0.1 | 255.255.255.255 | ens3 | UGH | [ 132.097319] cloud-init[548]: ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ [ 132.126704] cloud-init[548]: ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++ [ 132.154971] cloud-init[548]: ci-info: +-------+-------------+---------+-----------+-------+ [ 132.179131] cloud-init[548]: ci-info: | Route | Destination | Gateway | Interface | Flags | [ 132.211508] cloud-init[548]: ci-info: +-------+-------------+---------+-----------+-------+ [ 132.219367] cloud-init[548]: ci-info: | 0 | fe80::/64 | :: | ens3 | U | [ 132.259315] cloud-init[548]: ci-info: | 4 | ff00::/8 | :: | ens3 | U | [ 132.283589] cloud-init[548]: ci-info: +-------+-------------+---------+-----------+-------+ [ 132.311049] cloud-init[548]: Generating public/private rsa key pair. [ 132.318065] cloud-init[548]: Your identification has been saved in /etc/ssh/ssh_Host_rsa_key. [ 132.327114] cloud-init[548]: Your public key has been saved in /etc/ssh/ssh_Host_rsa_key.pub. [ 132.364865] cloud-init[548]: The key fingerprint is: [ 132.378265] cloud-init[548]: SHA256:IhhdlSjJqLvj6PGiwTxA+SX7HbTHc4nSKBkqSIY3ye4 root@test1 [ 132.405438] cloud-init[548]: The key's randomart image is:

0
Gudise Akhil