Refine the README for dashboard configuration

v1.14.8
Li Yi 5 years ago
parent 63b4a95301
commit 6f867d9c75

@ -90,11 +90,11 @@ pred='process matches ".*(ocker|vpnkit).*"
### 配置 Kubernetes ### 配置 Kubernetes
可选操作: 切换Kubernetes运行上下文至 docker-desktop (docker-ce 18.09 下 context 为 docker-desktop) 可选操作: 切换Kubernetes运行上下文至 docker-desktop (之前版本的 context 为 docker-for-desktop)
```shell ```shell
kubectl config use-context docker-for-desktop kubectl config use-context docker-desktop
``` ```
验证 Kubernetes 集群状态 验证 Kubernetes 集群状态
@ -104,7 +104,9 @@ kubectl cluster-info
kubectl get nodes kubectl get nodes
``` ```
部署 Kubernetes dashboard ### 配置 Kubernetes 控制台
#### 部署 Kubernetes dashboard
```shell ```shell
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
@ -126,14 +128,14 @@ kubectl proxy
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default
### 配置 kubeconfig (可跳过) #### 配置控制台访问令牌
对于Mac环境 对于Mac环境
```shell ```shell
TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}') TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}')
kubectl config set-credentials docker-for-desktop --token="${TOKEN}" kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
echo $TOKEN
``` ```
对于Windows环境 对于Windows环境
@ -141,13 +143,18 @@ kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
```shell ```shell
$TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1] $TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]
kubectl config set-credentials docker-for-desktop --token="${TOKEN}" kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
echo $TOKEN
``` ```
#### 登录dashboard的时候选择 kubeconfig 文件 #### 登录dashboard的时候
![resource](images/k8s_credentials.png) ![resource](images/k8s_credentials.png)
选择 kubeconfig 文件,路径如下: 选择 **令牌**
输入上文控制台输出的内容
或者选择 **Kubeconfig** 文件,路径如下:
``` ```
Mac: $HOME/.kube/config Mac: $HOME/.kube/config

@ -73,11 +73,11 @@ Enable Kubernetes in Docker for Windows, and wait a while for Kubernetes is runn
### Config Kubernetes ### Config Kubernetes
Optional: switch the context to `docker-desktop` (under docker ce 18.09, the conext is `docker-desktop`) Optional: switch the context to `docker-desktop` (In the former version, the context is `docker-for-desktop`)
```shell ```shell
kubectl config use-context docker-for-desktop kubectl config use-context docker-desktop
``` ```
Verify Kubernetes installation Verify Kubernetes installation
@ -87,7 +87,10 @@ kubectl cluster-info
kubectl get nodes kubectl get nodes
``` ```
Deploy Kubernetes dashboard
### Deploy Kubernetes dashboard
#### Install Kubernetes dashboard
```shell ```shell
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
@ -105,17 +108,18 @@ Start proxy for API server
kubectl proxy kubectl proxy
``` ```
Access Kubernetes dashboard #### Access Kubernetes dashboard
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default
#### Config kubeconfig (Or skip) #### Config Token for dashboard
For Mac For Mac
```bash ```bash
TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}') TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}')
kubectl config set-credentials docker-for-desktop --token="${TOKEN}" kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
echo $TOKEN
``` ```
For Windows For Windows
@ -123,13 +127,16 @@ For Windows
```cmd ```cmd
$TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1] $TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]
kubectl config set-credentials docker-for-desktop --token="${TOKEN}" kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
echo $TOKEN
``` ```
#### Choose kubeconfig file (Optional) #### Login dashboard
![resource](images/k8s_credentials.png) ![resource](images/k8s_credentials.png)
Choose kubeconfig file, Path Choose **Token**, and input the output from above result
Or, choose **Kubeconfig**, select file from below path
``` ```
Win: %UserProfile%\.kube\config Win: %UserProfile%\.kube\config

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Loading…
Cancel
Save