使用 kubernetes dashboard
參照步驟
Deploying the
Dashboard UI
The Dashboard UI is
not deployed by default. To deploy it, run the following command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
若執行過程出現
The
ClusterRoleBinding "kubernetes-dashboard" is invalid: roleRef:
Invalid value: rbac.RoleRef{APIGroup:"rbac.authorization.k8s.io",
Kind:"ClusterRole", Name:"kubernetes-dashboard"}: cannot
change roleRef
解決方式
參考
--
You should delete
Dashboard related resources before upgrading or only edit deployment to bump
image version.
執行
kubectl delete clusterrolebinding kubernetes-dashboard
再重新執行
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
應該就可以正常完成
執行 kubectl proxy
若只想看url 則執行 kubectl proxy --url
使用官方推薦連結進入 kubernetes dashboard
會出現一登入畫面
依照
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
建立使用者
or
簡易使用者設定檔
參照
執行
kubectl apply -f
dashboard-adminuser.yaml
檔案內容
vi
dashboard-adminuser.yaml
---
apiVersion: v1
kind: Namespace
metadata:
name: kubernetes-dashboard
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
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
接著使用 Token 認證方式進入
Getting a Bearer
Token
kubectl -n kubernetes-dashboard describe secret
$(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print
$1}')
將產出的 Token 資訊貼上
將產出的 Token 資訊貼上
沒有留言 :
張貼留言