k8s安装dashboard
时间: 2023-10-12 09:08:33 浏览: 104
k8s-dashboard
安装 Kubernetes Dashboard 可以通过以下步骤进行:
1. 下载 Kubernetes Dashboard YAML 文件:
```
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
```
2. 打开 recommended.yaml 文件并找到以下部分:
```yaml
# ...
args:
# ...
- --enable-skip-login
# ...
```
将 `--enable-skip-login` 修改为 `--disable-skip-login`。
3. 部署 Kubernetes Dashboard:
```
kubectl apply -f recommended.yaml
```
4. 配置 Dashboard Service 类型为 NodePort:
```
kubectl patch service kubernetes-dashboard -n kubernetes-dashboard --type=json -p '[{"op": "replace", "path": "/spec/type", "value": "NodePort"}]'
```
5. 获取 Dashboard NodePort:
```
kubectl get service kubernetes-dashboard -n kubernetes-dashboard
```
6. 打开浏览器并访问 Kubernetes Dashboard:
```
https://<master-node-ip>:<dashboard-node-port>
```
其中,`<master-node-ip>` 是 Kubernetes 集群的主节点 IP,`<dashboard-node-port>` 是上一步获取的 NodePort。
阅读全文