The content of this section:
- Configure Dashboard
- Execute all the defined files
- Check execution results
- Visit dashboard
This is followed by the previous "binary mode deployment Kubernetes 1.6.0 cluster (Open TLS)" written.
Kubernetes Dashboard is a general purpose, the web-based UI for Kubernetes clusters. It allows users to manage applications running in the cluster and troubleshoot them, as well as manage the cluster itself.
First, configure the Dashboard
Official file directory: Https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dashboard
The files I use:
Download 3 files from Https://github.com/rootsongjc/follow-me-install-kubernetes-cluster/tree/master/manifests/dashboard, and uploaded to the/opt/kube-dashboard/directory.
mkdir kube-dashboard[[email protected] opt]# CD kube-dashboard/[[email protected] kube LSdashboard-controller.yaml dashboard-rbac.yaml Dashboard-service.yaml
Modify the Dashboard-controller.yaml file to change the image inside to:
Index.tenxcloud.com/jimmy/kubernetes-dashboard-amd64:v1. 6.0
Since Kube-apiserver has enabled RBAC authorization, and the Dashboard-controller.yaml of the official source directory does not define an authorized ServiceAccount, subsequent access to the Kube-apiserver API is rejected , tips in the Web:
Forbidden (403"system:serviceaccount:kube-system:default"in "default". (Get Jobs.batch)
Therefore, an Dashboard-rbac.yaml file is added, a serviceaccount named dashboard is defined, and then it is bound to the Cluster Role view.
II. implementation of all defined documents
#pwd/opt/kube-dashboard#lsDashboard-controller.yaml Dashboard-rbac.yaml dashboard-service.yaml# Kubectl Create-F. Deployment"Kubernetes-dashboard"Createdserviceaccount"Dashboard"createdclusterrolebinding"Dashboard"Createdservice"Kubernetes-dashboard"Created
Iii. Check the results of the implementation
1. View the assigned Nodeport
# Kubectl Get services kubernetes-dashboard-n kube-systemNAME CLUSTER-ip external-IP PORT ( S) agekubernetes-dashboard 10.254. 207.77 <nodes> :32281/tcp 41s
- Nodeport 32281 maps to dashboard pod 80 port.
2. Check Controller
# Kubectl Get Deployment Kubernetes-dashboard- nkube- systemNAME desired current up-to- DATE AVAILABLE agekubernetes-dashboard 1 1 1 1 13m# kubectl get pods grep dashboardkubernetes-dashboard- 2888692679-tv54g 1/1 Running 0 13m
Iv. Visit Dashboard
There are three ways of doing this:
- Kubernetes-dashboard service exposes Nodeport, can use Http://NodeIP:nodePort address to access dashboard;
- Access Dashboard via Kube-apiserver (HTTPS 6443 port and HTTP 8080 port mode);
- Access Dashboard via KUBECTL proxy
1. Use Http://NodeIP:nodePort address to access Dashboard
# Kubectl Get services kubernetes-dashboard-n kube-systemNAME CLUSTER-ip external-IP PORT ( S) agekubernetes-dashboard 10.254. 207.77 <nodes> :32281/tcp 41s
Then check out which server the pod is running on in the cluster, and I'm here to check that it's running on the Node1 node, so the browser input http://172.16.7.151:32281/
2. Access Dashboard via KUBECTL proxy
(1) Start the agent
[Email protected] kube-dashboard]# kubectl proxy--address='172.16.7.151' --port= 8086 --accept-hosts='^*$' 172.16. 7.151:8086
- You need to specify the--accept-hosts option, or the browser prompts "unauthorized" When accessing the dashboard page
(2) Access
Browser access Url:http://172.16.7.151:8086/ui automatically jump to: http://172.16.7.151:8086/api/v1/proxy/namespaces/kube-system/ Services/kubernetes-dashboard/#/workload?namespace=default
3. Access Dashboard via Kube-apiserver
(1) Get a list of Cluster service addresses
[Email protected] ~]# kubectl cluster-infoKubernetes Master is running at https:// 172.16.7.151:6443Kubedns is running at https://172.16.7.151:6443/api/v1/proxy/namespaces/ Kube-system/services/kube-dnsKubernetes-dashboard is running at https://172.16.7.151:6443/API/V1 /proxy/namespaces/kube-system/services/kubernetes-dashboard'kubectl cluster-info Dump'.
(2) Import certificate
Converts the generated ADMIN.PEM certificate into a format.
[Email protected] ~]# cd/etc/kubernetes/ssl/~]# OpenSSL pkcs12-export-in Admin.pem -out Admin.p12-inkey Admin-key.pem
Import the generated ADMIN.P12 certificate into your PC, and when exporting, remember the password you set and use it when importing.
If you do not want to use HTTPS, you can access insecure port 8080 directly: http://172.16.7.151:8080/api/v1/proxy/namespaces/kube-system/services/ Kubernetes-dashboard
Due to the lack of heapster plug-in, the current dashboard can not show Pod, Nodes CPU, memory and other metric graphics.
Kubernetes1.6 on the cluster (TLS on) installation dashboard