Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "kubectl proxy" instead of a NodePort to expose the dashboard. #3210

Merged
merged 16 commits into from
Oct 4, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add function comments, improve proxy stdout log message
  • Loading branch information
tstromberg committed Oct 3, 2018
commit 2956621c20c048201c8884f3a26d6e294ac89240
5 changes: 4 additions & 1 deletion cmd/minikube/cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
var (
dashboardURLMode bool
// Matches: 127.0.0.1:8001
// TODO(tstromberg): Get kubectl to implement a stable supported output format.
hostPortRe = regexp.MustCompile(`127.0.0.1:\d{4,}`)
)

Expand Down Expand Up @@ -119,15 +120,17 @@ func kubectlProxy() (*exec.Cmd, string, error) {
if err != nil {
return nil, "", errors.Wrap(err, "reading stdout pipe")
}
glog.Infof("Output: %s ...", out)
glog.Infof("proxy stdout: %s", out)
return cmd, hostPortRe.FindString(out), nil
}

// dashboardURL generates a URL for accessing the dashboard service
func dashboardURL(proxy string, ns string, svc string) string {
// Reference: https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above
return fmt.Sprintf("http://%s/api/v1/nss/%s/services/http:%s:/proxy/", proxy, ns, svc)
}

// checkURL checks if a URL returns 200 HTTP OK
func checkURL(url string) error {
resp, err := http.Get(url)
glog.Infof("%s response: %s %+v", url, err, resp)
tstromberg marked this conversation as resolved.
Show resolved Hide resolved
Expand Down