diff --git a/internal/cmd/egctl/envoy_dashboard.go b/internal/cmd/egctl/envoy_dashboard.go index 4569e64fc85..9b8f8bdf327 100644 --- a/internal/cmd/egctl/envoy_dashboard.go +++ b/internal/cmd/egctl/envoy_dashboard.go @@ -26,7 +26,7 @@ func newEnvoyDashboardCmd() *cobra.Command { dashboardCmd := &cobra.Command{ Use: "envoy-proxy -n ", - Short: "Retrieves Envoy admin dashboard for the specified pod", + Short: "Retrieve Envoy admin dashboard for the specified pod", Long: `Retrieve Envoy admin dashboard for the specified pod.`, Example: ` # Retrieve Envoy admin dashboard for the specified pod. egctl experimental dashboard envoy-proxy -n @@ -47,6 +47,10 @@ func newEnvoyDashboardCmd() *cobra.Command { return nil }, RunE: func(c *cobra.Command, args []string) error { + if listenPort > 65535 || listenPort < 0 { + return fmt.Errorf("invalid port number range") + } + kubeClient, err := getCLIClient() if err != nil { return err @@ -66,7 +70,7 @@ func newEnvoyDashboardCmd() *cobra.Command { podNamespace = pl.Items[0].Namespace } - return portForward(podName, podNamespace, "http://%s", adminPort, kubeClient, c.OutOrStdout()) + return portForward(podName, podNamespace, "http://%s", listenPort, kubeClient, c.OutOrStdout()) }, } dashboardCmd.PersistentFlags().StringArrayVarP(&labelSelectors, "labels", "l", nil, "Labels to select the envoy proxy pod.") diff --git a/site/content/en/latest/user/egctl.md b/site/content/en/latest/user/egctl.md index dba019e1cf5..8fc3e391758 100644 --- a/site/content/en/latest/user/egctl.md +++ b/site/content/en/latest/user/egctl.md @@ -795,3 +795,21 @@ product backend ResolvedRefs True ResolvedRefs [Multi-tenancy]: ../deployment-mode#multi-tenancy [EnvoyProxy]: ../../api/extension_types#envoyproxy + + +## egctl experimental dashboard + +This subcommand streamlines the process for users to access the Envoy admin dashboard. By executing the following command: + +```bash +egctl x dashboard envoy-proxy -n envoy-gateway-system envoy-engw-eg-a9c23fbb-558f94486c-82wh4 +``` + +You will see the following output: + +```bash +egctl x dashboard envoy-proxy -n envoy-gateway-system envoy-engw-eg-a9c23fbb-558f94486c-82wh4 +http://localhost:19000 +``` + +the Envoy admin dashboard will automatically open in your default web browser. This eliminates the need to manually locate and expose the admin port.