1.安装heapster、influxdb和grafana
做角色绑定
kubectl apply -f https://raw.githubusercontent.com/kubernetes-retired/heapster/master/deploy/kube-config/rbac/heapster-rbac.yaml
安装heapster
kubectl apply -f https://raw.githubusercontent.com/kubernetes-retired/heapster/master/deploy/kube-config/influxdb/heapster.yaml
安装influxdb
kubectl apply -f https://raw.githubusercontent.com/kubernetes-retired/heapster/master/deploy/kube-config/influxdb/influxdb.yaml
安装grafana
kubectl apply -f https://raw.githubusercontent.com/kubernetes-retired/heapster/master/deploy/kube-config/influxdb/grafana.yaml
安装dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
2.修改网络配置
修改dashboard服务为nodePort,端口为30443
kubectl -n kube-system edit service kubernetes-dashboard
配置nodePort为30443
3.添加serviceAccount
新建admin.yaml,将serviceAccount admin-user和集群角色cluster-admin绑定
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: admin-user
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kube-system
#Kubectl apply -f admin.yaml
获取sa的token
#kubectl describe secret admin-user --namespace=kube-system
Name: admin-user-token-qqsrx
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: admin-user
kubernetes.io/service-account.uid: e4a0ef4b-17d0-11e9-8ad6-52540005f38a
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1025 bytes
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLXFxc3J4Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJlNGEwZWY0Yi0xN2QwLTExZTktOGFkNi01MjU0MDAwNWYzOGEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.8akFWt2sAMZr15C35HT0OOEghqsuN-COZDibYrjYuzxYGaQH68X-0WPJkllZ6OqQNAoD3IdVO5BGeWUs_zr71aS03cLB5FgJeViWz8QSNVUtCAr776exIiKGsEeGpjZ4zTGb_XMqTa69gne28D8BExTIzlKBn1o0w2K0lzZNU9TzvJodLj_nbEj0No5eNOvmnJuC7hnCPuckCuRC8W-a8FLxAElrOBoRyMfs_w1JBzotz-50fqo4dU5mMoShf5oG8Hk9LohkRUlOwDZhpD9WNkBgypH8tMe8mVWqmWg4w7lInu1uKcR5RtJdmz2vg-lOhaqkLm1xLzzRJCWmBPu9VA
4.访问dashboard
建议使用最新版的firefox访问https://nodeip:30443/
将token粘贴到网页上“输入令牌”处就可以登录了
网友评论