how to exit from ssh code example
Example: exit ssh
CTRL + d causes a logout. logout causes an exit. exit on its own is different only because it allows you to specify a non-zero exit code in case it's needed. So the first 3 options are equivalent.
Killing ssh, or the terminal will just break the connection. I'm not sure what you're going for with "gentle", but that is not it.
Assuming that by gentle you meant closing connections without errors on either side, just keep using CTRL + d