Skip to content

Add Option to Automatically Open Browser to a Path when Port Forwarding #1871

Description

@sergiosalvatore

What would you like to be added:
I would like to add a optional --browser flag to the port-forward command to allow the CLI to automatically open the browser and point to a particular path with the correct hostname and port. So, kubectl port-forward pod-0 :9090 --browser /admin would open the port-forward and, if successful, then automatically open the user's default browser to http://localhost:<whatever-automatic-port-is-chosen>/admin. The user could also specify protocol overrides (https vs http) if necessary.

We can use github.com/pkg/browser to deal with all the cross-platform browser issues as that package is well-used.

Why is this needed:
This will streamline the process of accessing that URL particularly when asking the operating system to pick a random open port so you no longer need to copy/paste from a terminal into a browser.

**Please note I've already implemented this in a local branch and would be happy to contribute it, but wanted to start with an issue first if there were any things about the design that warranted discussion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions