Kubernetes Dashboard1.8.3部署
- 说明 下文中所需镜像请点击images自行下载使用!
- 安装dashboard
#下载yaml
wget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
#查看yaml中image
image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.3
- 安装heapster
#下载yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/grafana.yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/rbac/heapster-rbac.yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/heapster.yaml
wget https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/influxdb.yaml
#修改yaml中image为自己的
#grafana.yaml
- name: grafana
image: k8s.gcr.io/heapster-grafana-amd64:v4.4.3
#heapster.yaml
- name: heapster
image: k8s.gcr.io/heapster-amd64:v1.5.3
#influxdb.yaml
- name: influxdb
image: k8s.gcr.io/heapster-influxdb-amd64:v1.3.3
- 修改kubernetes-dashboard.yaml 将service type设置为NodePort,修改后的yaml文件见yaml。
- 部署dashboard
#先cd到相应目录下
pwd
/etc/kubernetes/manifests/my.conf
#查看该目录下文件
ll
grafana.yaml
heapster-rbac.yaml
heapster.yaml
influxdb.yaml
kubernetes-dashboard.yaml
#部署service
kubectl create -f ./
#获取dashboard的外网访问端口:
kubectl -n kube-system get svc kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard NodePort 10.109.50.237 <none> 443:31173/TCP 1h
- 浏览器访问dashboard登陆页面 如http://192.168.2.100:31173 (使用http或https访问),支持使用kubeconfig和token两种的认证方式:
- 首次登入出现访问权限报错
#解决方法
##vi kube-dashboard-access.yaml
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system
##create kubectl create -f kube-dashboard-access.yaml
1. 登陆界面
![](https://s4.51cto.com/images/blog/201805/27/269bb9b6cb49c52cdfd2c40ee0463adb.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
![](https://s4.51cto.com/images/blog/201805/27/5221812964efa2ebb218ab0c55b3488d.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
1. 镜像使用总结
Master 和 Node 节点由于分工不一样,所以安装的服务不同,最终安装完毕,Master 和 Node 启动的核心服务分别如下:
| Image Name | Version | swarm2(master) | swarm1 |
| -------- | -------- | -------- | -------- |
| k8s.gcr.io/kube-apiserver-amd64 | v1.10.0 | 需要 | 不需要 |
| k8s.gcr.io/kube-controller-manager-amd64 | v1.10.0 | 需要 |不需要|
| k8s.gcr.io/kube-scheduler-amd64 | v1.10.0 | 需要 |不需要|
| k8s.gcr.io/kube-proxy-amd64 | v1.10.0 | 需要 |需要|
| k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64 | 1.14.8 | 需要 |不需要|
| k8s.gcr.io/k8s-dns-sidecar-amd64 | 1.14.8 | 需要 |不需要|
| k8s.gcr.io/k8s-dns-kube-dns-amd64 | 1.14.8 | 需要 |不需要|
| k8s.gcr.io/pause-amd64 | 3.1 | 需要 |需要|
| quay.io/coreos/flannel | v0.9.1 | 需要 |需要|
| quay.io/calico/node | v2.6.2 | 需要 |不需要|
| quay.io/calico/cni | v1.11.0 | 需要 |不需要|
| k8s.gcr.io/etcd-amd64 | 3.1.12| 需要 |不需要|
|k8s.gcr.io/kubernetes-dashboard-amd64| v1.8.3 |需要|需要|
|k8s.gcr.io/kubernetes-dashboard-init-amd64| v1.0.1|需要|需要|
|k8s.gcr.io/heapster-amd64| v1.5.3|需要|需要|
|k8s.gcr.io/heapster-influxdb-amd64 | v1.3.3|需要|需要|
|k8s.gcr.io/heapster-grafana-amd64| v4.4.3|需要|需要|