1. minikube dashboard
在 minikube 管理的 Kubernetes 集群中访问 Kubernetes 中运行的 dashboard
会在默认浏览器打开 dashboard 的 web 页面
[!TIP|type:flat] kubernetes dashboard 是 Kubernetes web 管理项目,可以通过浏览器的方式访问和管理 Kubernetes 集群。
minikube dashboard [flags]
1.1. Options
--port int Exposed port of the proxyfied dashboard. Set to 0 to pick a random port.
--url Display dashboard URL instead of opening a browser
1.2. 选项
选项 | 默认值 | 描述 |
---|---|---|
--port | - | 指定代理 dashboard 保留的端口,设置为 0 时,会随即产生一个端口 |
--url | - | 在命令行中显示 dashboard 的 URL,而不是直接打开浏览器 |
1.3. 从父命令继承的选项
--add_dir_header If true, adds the file directory to the header of the log messages
--alsologtostderr log to standard error as well as files
-b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm")
-h, --help
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--log_file string If non-empty, use this log file
--log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files
--one_output If true, only write logs to their native severity level (vs also writing to each lower severity level)
-p, --profile string The name of the minikube VM being used. This can be set to allow having multiple instances of minikube independently. (default "minikube")
--skip_headers If true, avoid header prefixes in the log messages
--skip_log_headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
--user string Specifies the user executing the operation. Useful for auditing operations executed by 3rd party tools. Defaults to the operating system username.
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
1.4. 示例
1.4.1. 在本地浏览器中打开 dashboard
启动 Kubernetes dashboard
[minikube@localhost ~]$ minikube dashboard --url
🔌 Enabling dashboard ...
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/dashboard:v2.3.1
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-scraper:v1.0.7
🤔 Verifying dashboard health ...
🚀 Launching proxy ...
🤔 Verifying proxy health ...
http://127.0.0.1:44221/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
[!TIP|style:flat] 这里显示和访问的代理地址是相对于执行 kubectl 节点的 127.0.0.1。
如果是远程命令行 SSH 登录到远程机器,是无法在 ssh client 节点生效。
在打开 dashboard 时,会自动在集群中启用 dashboard 的 addons 插件
[minikube@localhost ~]$ minikube addons list
|-----------------------------|---------|--------------|-----------------------|
| ADDON NAME | PROFILE | STATUS | MAINTAINER |
|-----------------------------|---------|--------------|-----------------------|
| ambassador | k8s2 | disabled | unknown (third-party) |
| auto-pause | k8s2 | disabled | google |
| csi-hostpath-driver | k8s2 | disabled | kubernetes |
| dashboard | k8s2 | enabled ✅ | kubernetes |
| default-storageclass | k8s2 | enabled ✅ | kubernetes |
| efk | k8s2 | disabled | unknown (third-party) |
......
然后再集群中启动相关的服务
[minikube@localhost ~]$ minikube kubectl -- get pods -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
dashboard-metrics-scraper-758548f849-xnfnw 1/1 Running 0 6m51s
kubernetes-dashboard-586fb768c4-cglsj 1/1 Running 0 6m51s