这个问题中的问题类似于使用封隔器构建RancherOS时SSH失败
然而,我的封隔器的行为是不同的。我得到了
==> virtualbox-iso: Error waiting for SSH: ssh: handshake failed: ssh:
unable to authenticate, attempted methods [none password keyboard-
interactive], no supported methods remain我不知道为什么Packer不能将ssh放入VM中。我可以看到VirtualBox控制台屏幕位于登录输入上。然后超时,并被封隔器的进程丢弃。
packer.json
{
"variables": {
"ros_version" : "v1.1.4",
"iso_md5" : "b1f395a86c7c040702ec77fe87abb2e2",
"vm_name" : "rancher_image"
},
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "https://releases.rancher.com/os/{{ user `ros_version` }}/rancheros.iso",
"guest_os_type": "Linux_64",
"guest_additions_mode": "disable",
"iso_checksum_type": "md5",
"iso_checksum": "{{ user `iso_md5` }}",
"output_directory": "output_rancheros",
"ssh_wait_timeout": "120s",
"shutdown_command": "sudo shutdown -h now",
"disk_size": 8000,
"ssh_username": "rancher",
"ssh_password": "rancher",
"headless" : false,
"ssh_port": 22,
"ssh_host_port_min": 2222,
"ssh_host_port_max": 4444,
"ssh_skip_nat_mapping": true,
"vm_name": "{{ user `vm_name` }}",
"boot_wait": "30s",
"vboxmanage":[
["modifyvm", "{{.Name}}", "--memory","4096"]
]
}
],
"provisioners": [
{
"type":"file",
"source": "cloud-config.yml",
"destination": "/tmp/cloud-config.yml"
},
{
"type": "shell",
"inline": [
"ifconfig",
"sudo ros install -d /dev/sda -f -c /tmp/cloud-config.yml -i rancher/os:{{ user `ros_version` }} --no-reboot"
]
}
]
}cloud-config.yml
#cloud-config
rancher:
ssh_authorized_keys:
- ssh-rsa AAA ... some VALID RSA email@email.com
network:
interfaces:
eth0:
dhcp: true
dns:
nameservers:
-8.8.8.8
-8.8.4.4编辑:在构建器中添加这些行,并从提供程序中删除它们的等价物。这仍然不能解决我想要的其他步骤,但至少可以上传云端配置并完成配置。
"http_directory":"http",
"boot_command":[
"<esc><esc><enter><wait>",
"wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/cloud-config.yml <enter>",
"sudo ros install -d /dev/sda -f -c cloud-config.yml -i rancher/os:{{ user `ros_version` }}",
"<enter>"],发布于 2018-03-06 17:33:27
默认情况下,RancherOS没有启用ssh密码。请参阅第1467期
发布于 2020-10-21 07:04:06
这对我有用。
{
"variables": {
"vcpus": "1",
"disk_size": "30000",
"ftp_proxy": "{{ env `ftp_proxy` }}",
"headless": "false",
"iso_checksum": "sha256:d70520b1edd51d3f45a407fbffd820ec4b5cc4a6b7a73d822a687facd9c07e92",
"iso_url": "https://github.com/rancher/os/releases/download/v1.5.6/rancheros.iso",
"memory": "2048",
"ssh_password": "rancher",
"ssh_username": "rancher",
"version": "0.1.0",
"ENVIRONMENT": "master",
"vm_name": "{{user `ENVIRONMENT`}}-rancher",
"format": "ovf",
"http_server": "http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
"output_path": "output-{{ user `vm_name` }}"
},
"builders": [
{
"boot_command": [
"<enter>",
"wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `vm_name` }}-cloud-config.yml <enter>",
"sudo ros install -d /dev/sda -f -c {{ user `vm_name` }}-cloud-config.yml -no-reboot <enter>",
"<wait15>",
"sudo shutdown <enter>"
],
"boot_wait": "30s",
"communicator": "none",
"cpus": "{{ user `vcpus` }}",
"disk_size": "{{ user `disk_size` }}",
"guest_os_type": "Linux_64",
"headless": "{{ user `headless` }}",
"http_directory": "http",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_url": "{{ user `iso_url` }}",
"memory": "{{ user `memory` }}",
"format": "{{ user `format` }}",
"output_directory": "{{ user `output_path` }}",
"disable_shutdown": true,
"shutdown_timeout": "5m",
"type": "virtualbox-iso",
"vm_name": "{{ user `vm_name` }}",
"guest_additions_mode": "disable",
"virtualbox_version_file": ""
}
]
}https://stackoverflow.com/questions/49133676
复制相似问题