Minikube: Not possible to use external ssh client

Created on 1 Mar 2020  路  6Comments  路  Source: kubernetes/minikube

For some reason, minikube ssh is not respecting the --native-ssh parameter.

Options:
      --native-ssh=true: Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh'
command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for
SSH'.

But when running minikube ssh --native-ssh=false, it still uses the native client.

libmachine: Using SSH client type: native

Seems like something is wrong with the parsing of parameters, with viper/cobra ?

                if viper.GetBool(nativeSSH) {
                        ssh.SetDefaultClient(ssh.Native)
                } else {
                        ssh.SetDefaultClient(ssh.External)
                }

kinbug prioritbacklog

All 6 comments

It works with minikube start but not with minikube ssh ,
The flag nativeSSH is not binded in ssh.go, needs something like viper.BindPFlags(..)

It seems to be a lot worse than that, not only does it need registering - it can only be done once

https://suraj.io/post/cobra-persistent-flag/

Actually, the nativeSSH used inside ssh.go is declared as a constant in start.go , hence the confusion

All the flags are constant (strings), but you are right it is part of the problem.

Rename the flag, and it starts working. So it's something fundamental viper.

.

All the flags are constant (strings), but you are right it is part of the problem.

Rename the flag, and it starts working. So it's something fundamental viper.

sorry my comment get truncated :

@afbjorklund

This is a potential fix :

cmd/ssh.go

...
...
var (
    nativeSsh bool
)
...
...
...
...
if nativeSsh { // no viper.GetBool
       ssh.SetDefaultClient(ssh.Native)
} else {
       ssh.SetDefaultClient(ssh.External)
}
...
...
...
...
func init() {
    sshCmd.Flags().BoolVar(&nativeSsh, "native-ssh",true, "Use native Golang SSH ...............
}

notice the new name nativeSSH => nativeSsh
Output result :
./minikube ssh --native-ssh=false --alsologtostderr -v=4

GuestAdditionsFacility_VirtualBox System Service=50,1583172070953
GuestAdditionsFacility_Seamless Mode=0,1583172070531
GuestAdditionsFacility_Graphics Mode=0,1583172070531
}
I0302 19:03:24.263592 8472 main.go:110] libmachine: STDERR:
{
}
I0302 19:03:24.263751 8472 main.go:110] libmachine: Using SSH client type: external

Regards,

Thanks, have to use a different name though (golint complains).

Was this page helpful?
0 / 5 - 0 ratings