使用 CF CLI 连接到 PCF Dev 时获取 'FAILED'
Getting 'FAILED' when connecting to PCF Dev with CF CLI
I 运行 带有 Vagrant 1.8.1 和 VirtualBox 5.0 的 CentOS x64 7.2 上的 pcf dev 0.15.0。
当我执行 vagrant up
时,(对我而言)似乎一切都在正常启动(尽管从 0 到 48 运行ning 服务需要几分钟时间)
PCF Dev has reserved 32 GB out of 46 GB total system memory.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'pcfdev/pcfdev' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Waiting for services to start...
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 37 out of 48 running
==> default: 48 out of 48 running
==> default: PCF Dev is now running.
==> default: To begin using PCF Dev, please run:
==> default: cf login -a api.local.pcfdev.io --skip-ssl-validation
==> default: Email: admin
==> default: Password: admin
我运行这个没有改变,唯一的变化是我设置VM_MEMORY
因为我想使用更多的内存(你可以在日志文件的第一行看到结果)
当我尝试使用 cf login -a api.local.pcfdev.io --skip-ssl-validation -v
登录时,无法解决这个问题,所以我使用 vagrant ssh
后 ifconfig
告诉我的 IP 地址:
eth0 Link encap:Ethernet HWaddr 08:00:27:6c:38:a8
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe6c:38a8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:823 errors:0 dropped:0 overruns:0 frame:0
TX packets:669 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:82923 (82.9 KB) TX bytes:83850 (83.8 KB)
eth1 Link encap:Ethernet HWaddr 08:00:27:02:34:18
inet addr:192.168.11.11 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe02:3418/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2955 (2.9 KB) TX bytes:4782 (4.7 KB)
这是我用cf:
连接时使用192.168.11.11
的结果
API endpoint: 192.168.11.11
REQUEST: [2016-06-10T10:24:37+02:00]
GET /v2/info HTTP/1.1
Host: 192.168.11.11
Accept: application/json
Content-Type: application/json
User-Agent: go-cli 6.18.1+a1103f0 / linux
RESPONSE: [2016-06-10T10:24:37+02:00]
HTTP/1.1 404 Not Found
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Fri, 10 Jun 2016 08:24:37 GMT
X-Cf-Routererror: unknown_route
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: ba181cbd-aaf3-43cf-4169-e2d7e42d19a5
404 Not Found: Requested route ('192.168.11.11') does not exist.
REQUEST: [2016-06-10T10:24:37+02:00]
GET /v2/info HTTP/1.1
Host: 192.168.11.11
Accept: application/json
Content-Type: application/json
User-Agent: go-cli 6.18.1+a1103f0 / linux
RESPONSE: [2016-06-10T10:24:37+02:00]
HTTP/1.1 404 Not Found
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Fri, 10 Jun 2016 08:24:37 GMT
X-Cf-Routererror: unknown_route
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: 69d68148-17ca-4434-4562-4a6fd90d7984
404 Not Found: Requested route ('192.168.11.11') does not exist.
FAILED
Server error, status code: 404, error code: 0, message:
看起来其他人在 Windows 中也遇到了类似的问题:https://github.com/pivotal-cf/pcfdev/issues/68
你尝试的是行不通的,因为 IP 不直接是 API 服务器的 IP,它是路由器的 IP,它将查看请求的主机并确定去哪里将请求代理到(例如,系统告诉它将 api.local.pcfdev.io
的请求代理到您的 PCF 开发箱内的云控制器 API 运行。
api.local.pcfdev.io
应该解析为 192.168.11.11
。任何 *.local.pcfdev.io
地址都可以,这是一个全局配置的 DNS,以方便使用 PCF Dev 的人。你甚至不必在你的机器上安装 PCF Dev 就可以工作,例如在我的机器上:
$ nslookup foo.local.pcfdev.io
Server: 208.69.43.23
Address: 208.69.43.23#53
Non-authoritative answer:
Name: foo.local.pcfdev.io
Address: 192.168.11.11
如果有一些限制阻止您的机器解析在世界范围内注册的地址,您可能需要教您的本地机器进行正确的 DNS 解析。一种选择是配置您的计算机以解析该通配符域:https://serverfault.com/questions/118378/in-my-etc-hosts-file-on-linux-osx-how-do-i-do-a-wildcard-subdomain
另一种方法是在 /etc/hosts
文件中为有限的系统组件列表定义 DNS 解析。我不是 100% 确定完整列表是什么,但我认为这可能会涵盖它:
blobstore.local.pcfdev.io
uaa.local.pcfdev.io
login.local.pcfdev.io
api.local.pcfdev.io
doppler.local.pcfdev.io
loggregator.local.pcfdev.io
除了系统组件之外,您还需要确保为您推送的每个应用设置 DNS。我相信默认情况下,您的应用程序可以通过 some-app-name.local.pcfdev.io
访问,但目前对您不起作用。在这里,您可以为您推送的每个应用程序设置额外的 /etc/hosts
记录,或者您可以选择您的机器可以解析为 192.168.11.11
的不同通配符应用程序域(例如尝试 192.168.11.11.xip.io
,尽管我怀疑你的机器也不喜欢 xip.io
)。您可以在此处详细了解如何告诉 PCF Dev 创建用于应用程序的新域:https://docs.cloudfoundry.org/adminguide/manage-domains-routes.html。因此,在这种情况下,您的应用可以在 some-app-name.192.168.11.11.xip.io
.
访问
不过,*.local.pcfdev.io
DNS 已在 public DNS 服务器上注册,所以最简单的事情就是弄清楚如何在您的计算机上进行解析。
I 运行 带有 Vagrant 1.8.1 和 VirtualBox 5.0 的 CentOS x64 7.2 上的 pcf dev 0.15.0。
当我执行 vagrant up
时,(对我而言)似乎一切都在正常启动(尽管从 0 到 48 运行ning 服务需要几分钟时间)
PCF Dev has reserved 32 GB out of 46 GB total system memory.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'pcfdev/pcfdev' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Waiting for services to start...
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 0 out of 48 running
==> default: 37 out of 48 running
==> default: 48 out of 48 running
==> default: PCF Dev is now running.
==> default: To begin using PCF Dev, please run:
==> default: cf login -a api.local.pcfdev.io --skip-ssl-validation
==> default: Email: admin
==> default: Password: admin
我运行这个没有改变,唯一的变化是我设置VM_MEMORY
因为我想使用更多的内存(你可以在日志文件的第一行看到结果)
当我尝试使用 cf login -a api.local.pcfdev.io --skip-ssl-validation -v
登录时,无法解决这个问题,所以我使用 vagrant ssh
后 ifconfig
告诉我的 IP 地址:
eth0 Link encap:Ethernet HWaddr 08:00:27:6c:38:a8
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe6c:38a8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:823 errors:0 dropped:0 overruns:0 frame:0
TX packets:669 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:82923 (82.9 KB) TX bytes:83850 (83.8 KB)
eth1 Link encap:Ethernet HWaddr 08:00:27:02:34:18
inet addr:192.168.11.11 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe02:3418/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2955 (2.9 KB) TX bytes:4782 (4.7 KB)
这是我用cf:
连接时使用192.168.11.11
的结果
API endpoint: 192.168.11.11
REQUEST: [2016-06-10T10:24:37+02:00]
GET /v2/info HTTP/1.1
Host: 192.168.11.11
Accept: application/json
Content-Type: application/json
User-Agent: go-cli 6.18.1+a1103f0 / linux
RESPONSE: [2016-06-10T10:24:37+02:00]
HTTP/1.1 404 Not Found
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Fri, 10 Jun 2016 08:24:37 GMT
X-Cf-Routererror: unknown_route
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: ba181cbd-aaf3-43cf-4169-e2d7e42d19a5
404 Not Found: Requested route ('192.168.11.11') does not exist.
REQUEST: [2016-06-10T10:24:37+02:00]
GET /v2/info HTTP/1.1
Host: 192.168.11.11
Accept: application/json
Content-Type: application/json
User-Agent: go-cli 6.18.1+a1103f0 / linux
RESPONSE: [2016-06-10T10:24:37+02:00]
HTTP/1.1 404 Not Found
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Fri, 10 Jun 2016 08:24:37 GMT
X-Cf-Routererror: unknown_route
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: 69d68148-17ca-4434-4562-4a6fd90d7984
404 Not Found: Requested route ('192.168.11.11') does not exist.
FAILED
Server error, status code: 404, error code: 0, message:
看起来其他人在 Windows 中也遇到了类似的问题:https://github.com/pivotal-cf/pcfdev/issues/68
你尝试的是行不通的,因为 IP 不直接是 API 服务器的 IP,它是路由器的 IP,它将查看请求的主机并确定去哪里将请求代理到(例如,系统告诉它将 api.local.pcfdev.io
的请求代理到您的 PCF 开发箱内的云控制器 API 运行。
api.local.pcfdev.io
应该解析为 192.168.11.11
。任何 *.local.pcfdev.io
地址都可以,这是一个全局配置的 DNS,以方便使用 PCF Dev 的人。你甚至不必在你的机器上安装 PCF Dev 就可以工作,例如在我的机器上:
$ nslookup foo.local.pcfdev.io
Server: 208.69.43.23
Address: 208.69.43.23#53
Non-authoritative answer:
Name: foo.local.pcfdev.io
Address: 192.168.11.11
如果有一些限制阻止您的机器解析在世界范围内注册的地址,您可能需要教您的本地机器进行正确的 DNS 解析。一种选择是配置您的计算机以解析该通配符域:https://serverfault.com/questions/118378/in-my-etc-hosts-file-on-linux-osx-how-do-i-do-a-wildcard-subdomain
另一种方法是在 /etc/hosts
文件中为有限的系统组件列表定义 DNS 解析。我不是 100% 确定完整列表是什么,但我认为这可能会涵盖它:
blobstore.local.pcfdev.io
uaa.local.pcfdev.io
login.local.pcfdev.io
api.local.pcfdev.io
doppler.local.pcfdev.io
loggregator.local.pcfdev.io
除了系统组件之外,您还需要确保为您推送的每个应用设置 DNS。我相信默认情况下,您的应用程序可以通过 some-app-name.local.pcfdev.io
访问,但目前对您不起作用。在这里,您可以为您推送的每个应用程序设置额外的 /etc/hosts
记录,或者您可以选择您的机器可以解析为 192.168.11.11
的不同通配符应用程序域(例如尝试 192.168.11.11.xip.io
,尽管我怀疑你的机器也不喜欢 xip.io
)。您可以在此处详细了解如何告诉 PCF Dev 创建用于应用程序的新域:https://docs.cloudfoundry.org/adminguide/manage-domains-routes.html。因此,在这种情况下,您的应用可以在 some-app-name.192.168.11.11.xip.io
.
不过,*.local.pcfdev.io
DNS 已在 public DNS 服务器上注册,所以最简单的事情就是弄清楚如何在您的计算机上进行解析。