其他分享
首页 > 其他分享> > k8s安装Dashboard

k8s安装Dashboard

作者:互联网

安装dashboard

wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.6.0/aio/deploy/recommended.yaml
kubectl apply -f recommended.yaml

查看pod

kubectl get pods --all-namespaces

 

 查看service

 

 修改dashboad服务类型

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
spec:
  ports:
  - port: 443
    targetPort: 8443
  selector:
    k8s-app: kubernetes-dashboard
  type: NodePort

 

 创建kubernetes-dashboard管理员角色

apiVersion: v1
kind: ServiceAccount
metadata:
  name: dashboard-admin
  namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: dashboard-admin
subjects:
  - kind: ServiceAccount
    name: dashboard-admin
    namespace: kube-system
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io

查看token

kubectl get secret -n kube-system |grep admin|awk '{print $1}'
kubectl describe secret dashboard-admin-token-rmbcx -n kube-system|grep '^token'|awk '{print $2}'

浏览器打开dashboard

 

 

 

标签:kind,name,kubernetes,admin,Dashboard,k8s,安装,dashboard
来源: https://www.cnblogs.com/navysummer/p/16537205.html