可行的解决方法之一
https://www.cnblogs.com/Pan-xi-yi/p/12120876.html
环境说明
平台及镜像
Virtual Box + Centos7 镜像建立 三个VM.
网络环境:
1、controller: hostonly网卡+nat网卡+桥接网卡
2、compute: hostonly网卡+nat网卡+桥接网卡
3、cinder: hostonly网卡+nat网卡+桥接网卡
nat网卡用于上网(每个节点都是10.0.2.15。。。),桥接网卡是学校的dhcp服务器分配的ip,需要校园网认证,故只用于节点的地址绑定,hostonly网卡用于创建虚拟机时为虚拟机指定网络地址分配以及网关(如果用桥接网卡分配的ip,会导致compute节点网络down掉,不知道为啥)。
问题描述
使用http://cloud.centos.org/centos/7/images提供的镜像。
下载链接:https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1907.raw.tar.gz ,(windows 下载似乎更快),再上传到虚拟机,进行转换位qcow2格式。
转换:
#首先解压,压缩后的镜像比较小,下载也比较快
$ tar -zxvf CentOS-7-x86_64-GenericCloud-1907.raw.tar.gz
#转化镜像格式,raw格式转化为qcow2格式
$ qemu-img convert -f raw -O qcow2 CentOS-7-x86_64-GenericCloud-1907.raw CentOS-7-x86_64-GenericCloud-1907.qcow2
$ ls
CentOS-7-x86_64-GenericCloud-1907.qcow2
状态查看
启动实例时一切(电源状态,实例状态)都正常。
日志详情
但是日志如下(部分),
日志长度
35
[[32m OK [0m] Reached target Cloud-config availability.
Starting Apply the settings specified in cloud-config...
Starting Permit User Sessions...
Starting OpenSSH Server Key Generation...
[[32m OK [0m] Started Notify NFS peers of a restart.
[[32m OK [0m] Started System Logging Service.
[[32m OK [0m] Started Permit User Sessions.
[[32m OK [0m] Started Getty on tty1.
[[32m OK [0m] Started Command Scheduler.
[[32m OK [0m] Started Serial Getty on ttyS0.
[[32m OK [0m] Reached target Login Prompts.
CentOS Linux 7 (Core)
Kernel 3.10.0-957.27.2.el7.x86_64 on an x86_64
localhost login: [ 368.561478] cloud-init[1130]: Cloud-init v. 18.2 running 'modules:config' at Sat, 28 Dec 2019 14:27:39 +0000. Up 366.95 seconds.
[ 379.078580] cloud-init[1294]: Cloud-init v. 18.2 running 'modules:final' at Sat, 28 Dec 2019 14:27:50 +0000. Up 377.68 seconds.
ci-info: no authorized ssh keys fingerprints found for user centos.
[ 379.635130] cloud-init[1294]: ci-info: no authorized ssh keys fingerprints found for user centos.
ec2:
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 256 SHA256:Tz4F/s+zaeprQRSFY3yEK5SEFAV2XhBdw+jFpqAkY8U no comment (ECDSA)
ec2: 256 SHA256:MCCBOGXyGBbrnPchuRfW4IEjdeT9Q1NZYFnfQjAHa3k no comment (ED25519)
ec2: 2048 SHA256:IMVF+7DV3vftSG7E4XYXfD3RLWDTQfJlCWTE+4bp27Y no comment (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCQoqYjhsDa6KhHi9oxFfNT3/Qvs2sDsHUAnbTBD1FP87+lKRU4jXrkwtWr0bl0crLX079qXsNXvm0SFUACHbUw=
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILggoKs+3gH6iMsWfRIjqOELWFqx4cTca1tyBi6f67QJ
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2L25mO7Nx5Ygn/yeARAJw7wvU0wxtH+w/6IFwnUmsWSqbcXFZbEIZgaTJjCpF+O0qDk1BDDvErTA7g94qRoLolmzL/NIhRpsc15E+mGSNfBaCLkZvMQyhHKKPzCs/eTKy9H0C4J4oX46q0TQaXlmqKfHwoYMmoT2qxYFAS3KWkIVjJAt59961Pqcsl4U8p2TymM+bxe4v4zKq4w1Yf7gXL0WBu+gOxsOtVEdXGFsSNeD+Myf7hTlHL4GGSfyK3/MJFTqTg0cskz8CMTWrJJHX9k9rR5Edg0AufuggHw0VtvbCEn3mcNqhuUdS7M9GhqDQPTBwjv3nt5dWgd+Mu86h
-----END SSH HOST KEY KEYS-----
[ 381.757862] cloud-init[1294]: Cloud-init v. 18.2 finished at Sat, 28 Dec 2019 14:27:54 +0000. Datasource DataSourceNone. Up 381.59 seconds
[ 381.792597] cloud-init[1294]: 2019-12-28 14:27:54,470 - cc_final_message.py[WARNING]: Used fallback datasource
看dashboard的日志好像是说没有将ssh指定的key注入到镜像中。。
ssh登陆
尝试一下,使用ssh指定私钥文件进行登陆,似乎失败了。
解决!!