gardener-attic / gardenctl

Command-line client for the Gardener.
Other
56 stars 42 forks source link

gardenctl ssh <openstack_node> fails with `Operation timed out` #444

Closed dansible closed 3 years ago

dansible commented 4 years ago

Describe the bug gardenctl ssh <openstack_node> fails with Cmd was unsuccessful (using gardenctl/gctl-os cluster)

To Reproduce Using 52235f2f with a test cluster gives:

$ go run cmd/gardenctl/main.go ssh shoot--gardenctl--gctl-os-worker-lx07a-z1-f46b4-pbp2b exit

Warning:
Be aware that you are entering an untrusted environment!
Do not enter credentials or sensitive data within the ssh session that cluster owners should not have access to.

Downloaded id_rsa key
Check Public IP
(1/5) Getting the external network for creating FIP
The external network ID is f55c8e3d-c798-4c6c-9f7e-eeb6600f6aed
(2/5) Creating floating IP from external network
The floating IP created is XXXX
(3/5) Add floating IP to openstack server node
(4/5) Establishing SSH connection

ssh: connect to host XXXX port 22: Operation timed out
exit status 255

(5/5) Cleanup
De-associate server with floating ip
Delete the floating IP

$ echo $?
0

Unfortunately, this also doesn't return an error because the cleanup operation succeeded. It would be great to also expose the error code to the end user (even if the cleanup was successful)

Gardenctl Version (please complete the following information):

neo-liang-sap commented 4 years ago

/assign

neo-liang-sap commented 4 years ago

PR submitted for review https://github.com/gardener/gardenctl/pull/445

dansible commented 3 years ago

It seems the cleanup process doesn't finish successfully:

$ go run cmd/gardenctl/main.go ssh shoot--gardenctl--gctl-os-worker-lx07a-z1-f46b4-hjqrv exit

Warning:
Be aware that you are entering an untrusted environment!
Do not enter credentials or sensitive data within the ssh session that cluster owners should not have access to.

Downloaded id_rsa key
Check Public IP
(1/5) Getting the external network for creating FIP
The external network ID is f55c8e3d-c798-4c6c-9f7e-eeb6600f6aed
(2/5) Creating floating IP from external network
The floating IP created is xxxx
(3/5) Add floating IP to openstack server node
Connecting error: dial tcp xxxx:22: i/o timeout
(4/5) Establishing SSH connection

Warning: Permanently added 'xxxx (ED25519) to the list of known hosts.

(5/5) Cleanup
De-associate server with floating ip
Delete the floating IP
exit status 1
neo-liang-sap commented 3 years ago

Hi @dansible , maybe could you please try with this PR? (https://github.com/gardener/gardenctl/pull/446) i guess the exit status 1 is not returned by clean up function but from the CheckIPPortReachable function, i did some improvement for this function in above PR. image from my testing using above PR this is OK If you still meet problem let's have a screenshare session to investigate. Thanks! -Neo

dansible commented 3 years ago

Cool, let's wait until https://github.com/gardener/gardenctl/issues/455 is fixed which will unblock these other issues

neo-liang-sap commented 3 years ago

as https://github.com/gardener/gardenctl/issues/455 merged, closing this issue as fixed /close