0

见鬼,我正在尝试使用 terraform 部署 rke k8s,但我无法通过 ssh 连接到所需的主机:

 time="2022-02-28T11:17:38+01:00" level=warning msg="Failed to set up SSH tunneling for host [poc-k8s.my-domain.com]: Can't retrieve Docker Info: error during connect: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info\": Unable to access node with address [poc-k8s.my-domain.com:22] using SSH. Please check if you are able to SSH to the node using the specified SSH Private Key and if you have configured the correct SSH username. Error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain"

这是.tf我正在使用的文件:

terraform {
  required_providers {
    rke = {
      source = "rancher/rke"
      version = "1.3.0"
    }
  }
}

provider "rke" {
  log_file = "rke_debug.log"
}


resource "rke_cluster" "cluster" {
  nodes {
    address = "poc-k8s.my-domain.com"
    user    = "root"
    role    = ["controlplane", "worker", "etcd"]
    ssh_key = file("~/.ssh/root_key")
  }
  nodes {
    address = "poc-k8s.my-domain.com"
    user    = "root"
    role    = ["worker", "etcd"]
    ssh_key = file("~/.ssh/root_key")
  }
  addons_include = [
    "https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml",
    "https://gist.githubusercontent.com/superseb/499f2caa2637c404af41cfb7e5f4a938/raw/930841ac00653fdff8beca61dab9a20bb8983782/k8s-dashboard-user.yml",
  ]
}

resource "local_file" "kube_cluster_yaml" {
  filename = "~/.kube/kube_config_cluster.yml"
  sensitive_content  = "rke_cluster.cluster.kube_config_yaml"
}

如果密钥当然正确并且我能够连接到所需的主机,则密钥:

ssh -i ~/.ssh/root_key root@poc-k8s.my-domain.com

我在这里想念什么?

4

0 回答 0