derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.19k stars 1.7k forks source link

hostctl integration #777

Open guumaster opened 4 years ago

guumaster commented 4 years ago




Is your feature request related to a problem? Please describe. Port-forwards are ok, but sometime is useful to have proper domain names to services. Doing this trough /etc/hosts is tedious and boring.

Describe the solution you'd like There is a tool called hostctl that can automate this process. It would be nice to have it integrated as a k9s feature.

Is this something that may interest you, @derailed and the team of contributors?

Additional context Disclaimer: I'm the author of hostctl and also a very happy user of k9s, seeing both integrated would be awesome.

mycrEEpy commented 4 years ago

@guumaster What about using the plugin mechanism of k9s, should be a useful start? What's your idea of usage? Selecting a service and adding a profile named k9s with servicename.namespace.svc.cluster.local to localhost and opening a port-forward via kubectl?

guumaster commented 4 years ago

@mycrEEpy I didn't know that you could make plugins for K9s. I'll check on that.

Basically hostctl allows you to define names on your /etc/hosts (or windows equivalent) to resolve names to any IP.

If you have deployments linked with ingress on your local machine, you could access directly through a local url like: http://something.awesome.loc

mycrEEpy commented 4 years ago

@guumaster Quick dump of my idea with the services:

plugin:
  hostctl:
    shortCut: Shift-H
    description: "Add To Hosts File"
    scopes:
      - services
    command: hostctl
    background: true
    confirm: true
    args:
      - add
      - domains
      - k9s
      - $NAME.$COL-NAMESPACE.svc.cluster.local

Is this a good starting point where you might go on with your ideas?

guumaster commented 4 years ago

wow, is that easy to make a plugin? nice!.

But first I'm figuring out how to workaround the need to use sudo each time you modify /etc/hosts file. To avoid asking for sudo pass inside k9s