标签:meta esc label auth 没有 docker new col author
1.下载dashboard: [root@master kubernetes]# wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta5/aio/deploy/recommended.yaml 2.修改配置文件: [root@master kubernetes]#vim recommended.yaml kind: Service apiVersion: v1 metadata: labels: k8s-app: kubernetes-dashboard name: kubernetes-dashboard namespace: kubernetes-dashboard spec: type: NodePort ##增加此字段 ports: - port: 443 targetPort: 8443 selector: k8s-app: kubernetes-dashboard [root@master kubernetes]# kubectl apply -f recommended.yaml
3.创建dashboard管理员: 创建key文件 openssl genrsa -out dashboard.key 2048 #证书请求 openssl req -days 36000 -new -out dashboard.csr -key dashboard.key -subj ‘/CN=dashboard-cert‘ #自签证书 openssl x509 -req -in dashboard.csr -signkey dashboard.key -out dashboard.crt #创建kubernetes-dashboard-certs对象 kubectl create secret generic kubernetes-dashboard-certs --from-file=dashboard.key --from-file=dashboard.crt -n kubernetes-dashboard
[root@master dashboard-v2.0]# vim dashboard-admin.yaml apiVersion: v1 kind: ServiceAccount metadata: labels: k8s-app: kubernetes-dashboard name: dashboard-admin namespace: kubernetes-dashboard [root@master dashboard-v2.0]#kubectl apply -f dashboard-admin.yaml [root@master dashboard-v2.0]# vim dashboard-admin-bind-cluster-role.yaml apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: labels: k8s-app: kubernetes-dashboard name: dashboard-admin-bind-cluster-role roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: dashboard-admin namespace: kubernetes-dashboard [root@master dashboard-v2.0]#kubectl apply -f dashboard-admin-bind-cluster-role.yaml [root@master dashboard-v2.0]#kubectl get secret -n kubernetes-dashboard [root@master dashboard-v2.0]# kubectl describe secret dashboard-admin-token-9rlc2 -n kubernetes-dashboard
注意,此时获取不到cpu,内存信息,因为没有按照metrics-server.
安装metrics-server:
1.下载镜像: docker pull bluersw/metrics-server-amd64:v0.3.6 docker tag bluersw/metrics-server-amd64:v0.3.6 k8s.gcr.io/metrics-server-amd64:v0.3.6 2.下载声明文件: wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/aggregated-metrics-reader.yaml wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/auth-delegator.yaml wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/auth-reader.yaml wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-apiservice.yaml wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-server-deployment.yaml wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-server-service.yaml wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/resource-reader.yaml
[root@master dashboard-v2.0]#vi metrics-server-deployment.yaml
[root@master metrics-server]# ll 总用量 32 -rw-r--r-- 1 root root 397 11月 18 23:33 aggregated-metrics-reader.yaml -rw-r--r-- 1 root root 303 11月 18 23:33 auth-delegator.yaml -rw-r--r-- 1 root root 324 11月 18 23:33 auth-reader.yaml -rw-r--r-- 1 root root 298 11月 18 23:33 metrics-apiservice.yaml -rw-r--r-- 1 root root 1230 11月 18 23:49 metrics-server-deployment.yaml -rw-r--r-- 1 root root 1129 11月 18 23:36 metrics-server-deployment.yaml.bak -rw-r--r-- 1 root root 297 11月 18 23:34 metrics-server-service.yaml -rw-r--r-- 1 root root 517 11月 18 23:34 resource-reader.yaml [root@master metrics-server]# kubectl apply -f ./
查看:
Kubernetes V1.16.2部署Dashboard V2.0(beta5)
标签:meta esc label auth 没有 docker new col author
原文地址:https://www.cnblogs.com/ccbyk-90/p/11886533.html