我在CoreOS上真的很新,我尝试使用official doc创建一个包含Vagrant的3个节点的群集。但是,当我访问其中一个节点并执行命令:fleetctl list-machines
时,输出显示一些错误:
E0729 09:29:05.725714 01013 fleetctl.go:141] error attempting to check latest fleet version in Registry: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error retrieving list of active machines: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
我可以通过代理访问互联网 - > 172.23.1.0:3128
我怀疑发生了错误,因为无法连接节点 https://discovery.etcd.io/2bef6823259cdef6751632f1f7052ff3 但是我不确定问题是什么,我做的是不知道如何解决它。
我正在使用:
Vagrant -----> 1.6.3
VirtualBox - > 4.3.10_Ubuntu
CoreOS包装盒 - > 367.1.0(稳定)
这些是我的资源文件:
Vagrantfile
# -*- mode: ruby -*-
# # vi: set ft=ruby :
require 'fileutils'
Vagrant.require_version ">= 1.6.0"
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
CONFIG = File.join(File.dirname(__FILE__), "config.rb")
# Defaults for config options defined in CONFIG
$num_instances = 1
$update_channel = "stable"
$enable_serial_logging = false
$vb_gui = false
$vb_memory = 1024
$vb_cpus = 1
# Attempt to apply the deprecated environment variable NUM_INSTANCES to
# $num_instances while allowing config.rb to override it
if ENV["NUM_INSTANCES"].to_i > 0 && ENV["NUM_INSTANCES"]
$num_instances = ENV["NUM_INSTANCES"].to_i
end
if File.exist?(CONFIG)
require CONFIG
end
Vagrant.configure("2") do |config|
config.vm.box = "coreos-%s" % $update_channel
#config.vm.box_version = ">= 308.0.1"
config.vm.box_url = "coreos_production_vagrant.box"
config.vm.provider :vmware_fusion do |vb, override|
override.vm.box_url = "coreos_production_vagrant.box"
end
config.vm.provider :virtualbox do |v|
v.check_guest_additions = false
v.functional_vboxsf = false
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
# plugin conflict
if Vagrant.has_plugin?("vagrant-vbguest") then
config.vbguest.auto_update = false
end
(1..$num_instances).each do |i|
config.vm.define vm_name = "core-%02d" % i do |config|
config.vm.hostname = vm_name
if $enable_serial_logging
logdir = File.join(File.dirname(__FILE__), "log")
FileUtils.mkdir_p(logdir)
serialFile = File.join(logdir, "%s-serial.txt" % vm_name)
FileUtils.touch(serialFile)
config.vm.provider :vmware_fusion do |v, override|
v.vmx["serial0.present"] = "TRUE"
v.vmx["serial0.fileType"] = "file"
v.vmx["serial0.fileName"] = serialFile
v.vmx["serial0.tryNoRxLoss"] = "FALSE"
end
config.vm.provider :virtualbox do |vb, override|
vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
vb.customize ["modifyvm", :id, "--uartmode1", serialFile]
end
end
if $expose_docker_tcp
config.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true
end
config.vm.provider :vmware_fusion do |vb|
vb.gui = $vb_gui
end
config.vm.provider :virtualbox do |vb|
vb.gui = $vb_gui
vb.memory = $vb_memory
vb.cpus = $vb_cpus
end
ip = "33.33.33.#{i+100}"
config.vm.network :private_network, ip: "#{ip}"
config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp']
if File.exist?(CLOUD_CONFIG_PATH)
config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => "/tmp/vagrantfile-user-data"
config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
end
end
end
end
用户数据:
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
# WARNING: replace each time you 'vagrant destroy'
discovery: https://discovery.etcd.io/2bef6823259cdef6751632f1f7052ff3
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
fleet:
public-ip: $public_ipv4
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
config.rb :
# Size of the CoreOS cluster created by Vagrant
$num_instances=3
# Official CoreOS channel from which updates should be downloaded
$update_channel='stable'
答案 0 :(得分:3)
最后,我从github repo下载 etcd ,然后在IP地址为10.10.10.10
的永久主机上运行 etcd 。然后,受到运行your own discovery endpoint的CoreOS指令的启发,我在 user-data:中设置了发现地址,如下所示:
discovery: http://10.10.10.10:4001/v2/keys/2bef6823259cdef6751632f1f7052ff3
在此之后,我可以执行vagrant up
,当我检查http://10.10.10.10:4001/v2/keys/2bef6823259cdef6751632f1f7052ff3
时,所有CoreOS实例都已注册。
答案 1 :(得分:0)
我为etd打开an issue以通过env vars支持代理,类似于CoreOS update_engine。
要在短期内解决此问题,您可以通过cli flag或配置文件对机器的对等地址列表进行硬编码。 --peers
或--peers-file
可能是您最好的选择。
答案 2 :(得分:0)
我遇到了同样的问题。就我而言,它是由#cloud-config中的陈旧发现URL引起的。我通过从https://discovery.etcd.io/new
获取新的发现网址来修复它