Packer 自定义映像构建失败并出现 ssh 身份验证错误
Posted
技术标签:
【中文标题】Packer 自定义映像构建失败并出现 ssh 身份验证错误【英文标题】:Packer custom image build failed with ssh authentication error 【发布时间】:2021-09-06 05:28:18 【问题描述】:我正在尝试为 AWS EKS 托管节点组构建自定义映像,注意:我的自定义映像 (ubuntu) 已经启用了 MFA 和基于私钥的身份验证。
我克隆了 github 存储库以从以下 url 构建与 eks 相关的更改。
git clone https://github.com/awslabs/amazon-eks-ami && cd amazon-eks-ami
接下来我做了一些更改来运行 make 文件
cat eks-worker-al2.json
"variables":
"aws_region": "eu-central-1",
"ami_name": "template",
"creator": "env `USER`",
"encrypted": "false",
"kms_key_id": "",
"aws_access_key_id": "env `AWS_ACCESS_KEY_ID`",
"aws_secret_access_key": "env `AWS_SECRET_ACCESS_KEY`",
"aws_session_token": "env `AWS_SESSION_TOKEN`",
"binary_bucket_name": "amazon-eks",
"binary_bucket_region": "eu-central-1",
"kubernetes_version": "1.20",
"kubernetes_build_date": null,
"kernel_version": "",
"docker_version": "19.03.13ce-1.amzn2",
"containerd_version": "1.4.1-2.amzn2",
"runc_version": "1.0.0-0.3.20210225.git12644e6.amzn2",
"cni_plugin_version": "v0.8.6",
"pull_cni_from_github": "true",
"source_ami_id": "ami-12345678",
"source_ami_owners": "00012345",
"source_ami_filter_name": "template",
"arch": null,
"instance_type": null,
"ami_description": "EKS Kubernetes Worker AMI with AmazonLinux2 image",
"cleanup_image": "true",
"ssh_interface": "",
"ssh_username": "nandu",
"ssh_private_key_file": "/home/nandu/.ssh/template_rsa.ppk",
"temporary_security_group_source_cidrs": "",
"security_group_id": "sg-08725678910",
"associate_public_ip_address": "",
"subnet_id": "subnet-01273896789",
"remote_folder": "",
"launch_block_device_mappings_volume_size": "4",
"ami_users": "",
"additional_yum_repos": "",
"sonobuoy_e2e_registry": ""
添加用户和私钥后构建失败并出现以下错误。
日志
amazon-ebs: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain.
【问题讨论】:
【参考方案1】:对我来说,只需更改 aws 的区域或删除打包程序中的 aws 区域。
【讨论】:
这没有提供问题的答案。一旦你有足够的reputation,你就可以comment on any post;相反,provide answers that don't require clarification from the asker。 - From Review以上是关于Packer 自定义映像构建失败并出现 ssh 身份验证错误的主要内容,如果未能解决你的问题,请参考以下文章