【发布时间】:2020-03-17 05:46:45
【问题描述】:
我正在尝试使用 terraform 部署“艰难地”部署 k8s。请在此处找到 repo:https://github.com/aidanSoles/kubernetes-the-hard-way-terraform
它是使用 Terraform 0.11 编写的,所以我选择不将代码升级到 0.12。
部署会创建 Google Cloud Platform 虚拟机并尝试在其上运行脚本。
我在应用配置时得到的错误信息是:
Error: Error applying plan:
2 errors occurred:
* google_compute_instance.k8s_worker: timeout - last error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
* google_compute_instance.k8s_controller: timeout - last error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
这是 google_compute_instance 供应商的 sn-p:
resource "google_compute_instance" "k8s_controller" {
boot_disk {
auto_delete = true
initialize_params {
image = "${var.controller_image}"
size = "${var.controller_size}"
}
}
can_ip_forward = true
count = "${var.controller_count}"
machine_type = "${var.controller_type}"
name = "k8s-controller${count.index}"
network_interface {
access_config = {}
subnetwork = "${google_compute_subnetwork.k8s_subnet.name}"
}
metadata {
creator = "${var.user}"
}
provisioner "file" {
connection {
private_key = "${file(var.ssh_path)}"
user = "${var.user}"
type = "ssh"
}
destination = "add-ssh-keys.sh"
source = "${var.scripts_path}/add-ssh-keys.sh"
}
}
你可以在这里找到完整的脚本:https://github.com/aidanSoles/kubernetes-the-hard-way-terraform/blob/master/compute.tf
我通过执行ssh -i 确保了user 和ssh_path 变量值是正确的。
我还尝试将agent = false 参数添加到文件配置器中,但无济于事。
知道问题的根源是什么吗?非常感谢。
【问题讨论】:
-
有趣。尝试重现它,看看这里可能是什么问题。我正确地执行了第 9 步和第 10 步没有错误吗?
标签: ssh kubernetes google-cloud-platform terraform