vmware-tanzu / crash-diagnostics

Crash-Diagnostics (Crashd) is a tool to help investigate, analyze, and troubleshoot unresponsive or crashed Kubernetes clusters.
Other
182 stars 43 forks source link

Make the FROM directive more user-friendly #33

Open antoninbas opened 4 years ago

antoninbas commented 4 years ago

A few ideas:

vladimirvivien commented 4 years ago

@antoninbas Thanks! These are great ideas and I was already thinking along those lines. I agree, if the api-server is up and running, FROM could retrieve IP info from it.

Can you elaborate on the following? Are you saying provide ability to target different host per AUTHCONFIG ?

enable the user to provide host names along with an ssh-config file

antoninbas commented 4 years ago

Hi @vladimirvivien. I was suggesting supporting ssh-config files. Here is an example:

Host k8s-node-master
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/abas/vmware/antrea/test/e2e/infra/vagrant/.vagrant/machines/k8s-node-master/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

Host k8s-node-worker-1
  HostName 127.0.0.1
  User vagrant
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/abas/vmware/antrea/test/e2e/infra/vagrant/.vagrant/machines/k8s-node-worker-1/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
...

The ssh-config file includes all the information required by the AUTHCONFIG command (username, private key). So it would be great if the AUTHCONFIG command could be enhanced to support ssh-config files. Then the diagnostics file could look like this:

FROM  k8s-node-master k8s-node-worker-1
AUTHCONFIG ssh-config:/foo/bar/ssh-config
// or for many people:
// AUTHCONFIG ssh-config:${HOME}/.ssh/config
...

Then the interpreter can see that an ssh-config file is provided, and it can use it to resolve IP addresses for each named host in the FROM directive (along with retrieving all the necessary information to establish the SSH connections).

If someone already has an ssh-config file (and I would believe it is pretty common) to manage SSH connections to nodes, then it would make it much easier to write the diagnostics file.

vladimirvivien commented 4 years ago

@antoninbas Thanks for the detail example. That sounds like a great idea to be able to use SSH config file directly. I will add that to the roadmap.