remche / terraform-openstack-rke

Terraform Openstack RKE
Mozilla Public License 2.0
37 stars 20 forks source link

fails when not using ssh-agent #43

Closed dhrp closed 4 years ago

dhrp commented 4 years ago

When I set

  use_ssh_agent      = false
  ssh_keypair_name   = "thatcher" # existing key on openstack

The module fails with the error:

"rke" Failed initializing cluster err:Error while reading SSH key file: "file name too long", it also prints the full content of my RSA key. It is somehow trying to use the content of my SSH key as the filename.

setting the variable ssh_key_file doesn't seem to make a difference.

When I switched to using ssh-agent ssh-add, no arguments this error went away.

remche commented 4 years ago

Thanks for the report. If your key is passphrase-protected, you have to set use_ssh_agent = true.

remche commented 4 years ago

@dhrp is it safe to close this issue ?

dhrp commented 4 years ago

No, I do not have a passphrase-protected ssh-key..

If I include the following:

module "rke" {
  use_ssh_agent      = false
  ssh_keypair_name   = "thatcher"
}

I get this error:

module.rke.module.rke.rke_cluster.cluster: Modifying... [id=6ff00396-409e-44de-892f-434265af50fd]

Error: 
============= RKE outputs ==============
time="2020-03-23T14:37:45+01:00" level=info msg="Updating RKE cluster..."
time="2020-03-23T14:37:45+01:00" level=info msg="Initiating Kubernetes cluster"

Failed initializing cluster err:Error while reading SSH key file: open -----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAx8tOI4qDln8b8E1jJDPUYSrJNPrs6S6cf5Ny9T2/4l3kFFdk
[...]
7NkT5WR9LwCyGFQZyslLzRCO9YliypS5li2rnWx7u32O3YI8Z5msqjE=
-----END RSA PRIVATE KEY-----
: file name too long
========================================

  on .terraform/modules/rke/remche-terraform-openstack-rke-f1d7e32/modules/rke/main.tf line 54, in resource "rke_cluster" "cluster":
  54: resource "rke_cluster" "cluster" {

And if I set use_ssh_agent to 'true' (without doing ssh-add), I get the following (which makes sense, since ssh-agent then doesn't know my key).


Failed running cluster err:[workerPlane] Failed to bring up Worker Plane: [Failed to verify healthcheck: Failed to check http://localhost:10248/healthz for service [kubelet] on host [45.129.173.183]: Get http://localhost:10248/healthz: Unable to access the service on localhost:10248. The service might be still starting up. Error: ssh: rejected: connect failed (Connection refused), log: F0323 13:31:45.957091    9871 server.go:273] failed to run Kubelet: could not init cloud provider "openstack": Authentication failed]
remche commented 4 years ago

@dhrp can you give #45 a try ?