【发布时间】:2016-11-29 18:04:40
【问题描述】:
今天在与 Chef、Kitchen、Vagrant 和 Virtual Box 合作时……我在尝试使用 Hashicorp (https://atlas.hashicorp.com/bento/) 托管的便当盒进行 Chef 食谱开发/测试时遇到了一个奇怪的问题。
在编写新的食谱时,我想测试一些目前不在我们环境中的 CentOS 7.2 和 Ubuntu 16.04 的较新版本。我求助于 hashcorp 的便当盒,将它们拉到我的 .kitchen.yml 配置中。
.kitchen.yml
---
driver:
name: vagrant
provisioner:
name: chef_zero
customize:
memory: 1024
platforms:
- name: ubuntu-16.04
suites:
- name: default
run_list:
- recipe[sandbox::default]
attributes:
使用 chef generate cookbook 创建了一个新的食谱,正如您在上面看到的,它使用了一个非常普通的厨房配置来开始工作。
在运行 kitchen create 时,在使用 Vagrant 和 Virtual Box 配置 VM 时,我一直遇到以下错误,即 SSH 超时。
错误:
Timed out while waiting for the machine to boot.
This means that Vagrant was unable to communicate with the guest machine
within the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
在观察 Virtual Box VM 控制台时,我注意到以下内容(见下面的屏幕截图)...
A start job is running for Raise network interfaces (2 min 39s / 5min 3s)
观察到 Vagrant 会在开始作业完成之前超时...我试图通过将我的 .kitchen.yml 中的 boot_timeout 从默认值 300 秒增加到 600 秒来解决此问题
但是,进一步的测试证明,即使虚拟机在 5 分钟 3 秒后成功初始化,这也不能解决问题...... Kitchen / Vagrant 无法 SSH 到主机,并且失败和 Vagrant SSH 超时持续存在。
【问题讨论】:
标签: vagrant chef-infra virtualbox test-kitchen