K8s:部署dashboard:修订间差异
建立內容為「== 部署 == <syntaxhighlight lang="bash"> # 部署 Kubernetes 仪表盘 GITHUB_URL=https://github.com/kubernetes/dashboard/releases VERSION_KUBE_DASHBOARD=$(curl…」的新頁面 |
|||
第43行: | 第43行: | ||
登录地址: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ | 登录地址: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ | ||
another way: | |||
<syntaxhighlight lang="bash"> | |||
sudo kubectl port-forward -n kubernetes-dashboard --address 0.0.0.0 service/kubernetes-dashboard 8080:443 | |||
</syntaxhighlight> | |||
https://<host ip>:8080 | |||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2021年10月13日 (三) 06:01的最新版本
部署
# 部署 Kubernetes 仪表盘
GITHUB_URL=https://github.com/kubernetes/dashboard/releases
VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||')
sudo k3s kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml
dashboard.admin-user.yml:
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
dashboard.admin-user-role.yml:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
sudo k3s kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml
登录
在host使用kubectl
kubectl -n kubernetes-dashboard describe secret admin-user-token | grep '^token'
kubectl proxy
another way:
sudo kubectl port-forward -n kubernetes-dashboard --address 0.0.0.0 service/kubernetes-dashboard 8080:443
https://<host ip>:8080