I am setting up a private network of 3 VMs (1 rancher
agent + 2 nodes) on my workstation using vagrant
and docker
provisioning.
Here is the Vagrantfile
used:
Vagrant.configure("2") do |config|
config.vm.define "lb", primary: true do |lb|
lb.vm.box = "ubuntu/xenial64"
lb.vm.synced_folder ".", "/vagrant", disabled: true
lb.vm.hostname = "server.node.test.com"
lb.vm.synced_folder "../somefolder/", "/workspace"
lb.vm.network :private_network, ip: "192.168.1.10"
lb.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = "2"
end
lb.vm.provision "docker" do |dock|
dock.run "rancher/server",
args: "-v '/workspace:/workspace' -p 8080:8080"
end
end
(1..2).each do |i|
config.vm.define "esnode#{i}" do |esnode|
esnode.vm.box = "ubuntu/xenial64"
esnode.vm.synced_folder ".", "/vagrant", disabled: true
esnode.vm.hostname = "client#{i}.node.test.com"
esnode.vm.network :private_network, ip: "192.168.1.1#{i}"
# esnode.vm.network "forwarded_port", guest: 80, host: "808#{i}"
esnode.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
end
end
end
Direct docker
provisioning for the two hosts fails (but that’s another issue).
Once the nodes are provisioned, I am trying to register the rancher
agent e.g. on esnode1
via:
sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.6 http://192.168.1.10:8080/v1/scripts/F9E3884A771CB877B1FD:1483142400000:lZFPk8u8xFEaZP3VpdV94YAmL4w
However:
INFO: Running Agent Registration Process, CATTLE_URL=http://192.168.1.10:8080/v1
INFO: Attempting to connect to: http://192.168.1.10:8080/v1
ERROR: http://192.168.1.10:8080/v1 is not accessible (The requested URL returned error: 404 Not Found)
But …
curl http://192.168.1.10:8080/v1
does work and returns a json
response with the api
details.
What could be wrong?