Я подготовил кластер из 4VM с этим Vagrantfile.
hosts = {
"n1" => "192.168.77.10",
"n2" => "192.168.77.11",
"n3" => "192.168.77.12",
"n4" => "192.168.77.13"
}
Vagrant.configure("2") do |config|
# always use Vagrants insecure key
config.ssh.insert_key = false
# forward ssh agent to easily ssh into the different machines
config.ssh.forward_agent = true
check_guest_additions = false
functional_vboxsf = false
config.vm.box = "ubuntu/bionic64"
hosts.each do |name, ip|
config.vm.define name do |machine|
machine.vm.network :private_network, ip: ip
machine.vm.provider "virtualbox" do |v|
v.name = name
end
end
end
end
Теперь у меня четыре запущенных виртуальных машины. После vagrant ssh n4 мой следующий шаг - ssh на другие машины, но я не могу справиться. Я пробовал это
vagrant ssh vagrant@192.168.77.10
The machine with the name 'vagrant@192.168.77.10' was not found configured for
this Vagrant environment.
Я уже разместил вопрос об отказе в разрешении
ssh vagrant@192.168.77.12
vagrant@192.168.77.12: Permission denied (publickey).
Этот пример взят из книги «Освоение Kubernetes». (Джиджи Сайфан) Я не уверен, есть ли у меня проблема с разрешениями или что-то еще. Не могу найти подобных примеров.
Я тогда попробовал
vagrant@ubuntu-bionic:~$ vagrant ssh vagrant@n1
The machine with the name 'vagrant@n1' was not found configured for
this Vagrant environment.
Это тоже не работает
vagrant@ubuntu-bionic:~$ ssh vagrant@n1
ssh: Could not resolve hostname n1: Temporary failure in name resolution
Я действительно не понимаю, что происходит.
Моя конфигурация
vagrant ssh-config
Host n1
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Host n2
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Host n3
HostName 127.0.0.1
User vagrant
Port 2201
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Host n4
HostName 127.0.0.1
User vagrant
Port 2202
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Если я попробую
ssh -vvv vagrant@n1
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/vagrant/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "n1" port 22
ssh: Could not resolve hostname n1: Temporary failure in name resolution
Джеральд предложил это
vagrant ssh n1
Вывод
The machine with the name 'n1' was not found configured for
this Vagrant environment.
В твоем vagrant up
папка, используйте vagrant ssh n1
Похоже, вы используете ключ ssh по умолчанию с config.ssh.insert_key = false
настройка, затем используйте ssh vagrant@192.168.77.10 -i ~/.vagrant.d/insecure_private_key
может сработать для вас.