kubernetes/minikube

SSH driver: --ssh-user argument seems to be ignored

Open

#12,632 opened on Sep 30, 2021

View on GitHub
 (11 comments) (1 reaction) (0 assignees)Go (31,799 stars) (5,222 forks)batch import
co/generic-driverhelp wantedkind/buglifecycle/frozenpriority/important-longterm

Description

Steps to reproduce the issue: minikube -p vm-cloud-k8s start --driver=ssh --native-ssh=false --ssh-user=vrubiolo --ssh-ip-address=vm-cloud --ssh-key=~/.ssh/id_rsa-vm_cloud --alsologtostderr -v=4 2>&1 | tee minikube.log

We can see futher down that minikube tries to connect using the root user, bypassing the --ssh-user option:

* Updating the running ssh "vm-cloud-k8s" bare metal machine ...
I0930 16:05:21.592604  898636 machine.go:88] provisioning docker machine ...
I0930 16:05:21.592842  898636 main.go:130] libmachine: Waiting for SSH to be available...
I0930 16:05:21.592906  898636 main.go:130] libmachine: Getting to WaitForSSH function...
I0930 16:05:21.593313  898636 main.go:130] libmachine: Using SSH client type: external
I0930 16:05:21.593462  898636 main.go:130] libmachine: &{[-F /dev/null -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none -o LogLevel=quiet -o PasswordAuthentication=no -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@vm-cloud -p 22] /usr/bin/ssh <nil>}
I0930 16:05:21.593526  898636 main.go:130] libmachine: About to run SSH command:
exit 0
I0930 16:05:21.703314  898636 main.go:130] libmachine: SSH cmd err, output: exit status 255: 
I0930 16:05:21.703385  898636 main.go:130] libmachine: Error getting ssh command 'exit 0' : ssh command error:
command : exit 0
err     : exit status 255

The machine does not allow SSH using the root account, which is why this fails. One can see this via the SSH command in verbose mode (this is why I used the external SSH binary):

$ /usr/bin/ssh -F /dev/null -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none -o LogLevel=verbose -o PasswordAuthentication=no -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@vm-cloud -p 22
Warning: Permanently added 'vm-cloud' (ED25519) to the list of known hosts.
root@vm-cloud: Permission denied (publickey).

Workaround Enable root account over SSH (if possible) for provisioning to continue.

Run minikube logs --file=logs.txt and drag and drop the log file into this issue minikube.log

This is minikube v1.23.1 on Fedora 34

Contributor guide

SSH driver: --ssh-user argument seems to be ignored · kubernetes/minikube#12632 | Good First Issue