CentOS7 Build Kubernetes Dashboard
An environmental statement
Centos7 Three, master node one, node nodes two
Dashboard requires a mirror and requires a command download:
Docker Pull mritd/kubernetes-dashboard-amd64:v1.5.1
PS: There are many other mirrors can also build dashboard, but this version is the Chinese version of
Note: All two node nodes need to download this image, the master node does not, because the dashboard pod is scheduled to be created by master to one of the two node, not created locally on master.
Two Specific operation
The following operations are all performed on the master node:
1. Edit Dashboard-controller.yaml to create a dashboard pod
Notice the changes in the Red font section!
Vim Dashboard-controller.yaml, the content is as follows:
Apiversion:extensions/v1beta1
Kind:deployment
Metadata:
Name:kubernetes-dashboard
Namespace: Kube-system
Labels:
k8s-app:kubernetes-dashboard
Kubernetes.io/cluster-service: "True"
Spec:
Selector:
Matchlabels:
k8s-app:kubernetes-dashboard
Template:
Metadata:
Labels:
K8s-app: Kubernetes-dashboard
Annotations:
Scheduler.alpha.kubernetes.io/critical-pod: '
Scheduler.alpha.kubernetes.io/tolerations: ' [{' key ': ' criticaladdonsonly ', ' operator ': ' Exists '}] '
Spec:
Containers:
- Name:kubernetes-dashboard
image:mritd/kubernetes-dashboard-amd64:v1.5.1
Imagepullpolicy:ifnotpresent
Resources
Limits
cpu:100m
Memory:50mi
Requests:
cpu:100m
Memory:50mi
Ports
- containerport:9090
Args
- --apiserver-host=http://10.0.2.90:8080
Livenessprobe:
HttpGet:
Path:/
port:9090
Initialdelayseconds:30
Timeoutseconds:30
Red Font Explanation:
- Mritd/kubernetes-dashboard-amd64:v1.5.1:dashboard Mirror, if you are not this image, please note that modify
- --apiserver-host=http://10.0.2.90:8080, fill in your master's apiserver address, the default port is generally 8080
===========================================================
OK, now start editing Dashboard-service.yaml and map the dashboard access port to the ports of the two node hosts for external access.
Vim Dashboard-service.yaml, the content is as follows:
Apiversion:v1
Kind:service
Metadata
Name:kubernetes-dashboard
Namespace:kube-system
Labels
K8s-app:kubernetes-dashboard
Kubernetes.io/cluster-service: "True"
Spec
Type:nodeport
Selector
K8s-app:kubernetes-dashboard
Ports
- Port:80
targetport:9090
nodeport:30003
Red Font Explanation:
Port refers to the service ports
Targetport refers to the port of the pod
Nodeport is the port where the host is node, and k8s is accessed through this port on the outside dashboard
Create Dashboard
Kubectl create-f Dashboard-controller.yaml
Results show: Deployment "Kubernetes-dashboard" created
Kubectl create-f Dashboard-service.yaml
Results show: Service "Kubernetes-dashboard" created
To view the creation results:
[[email protected] yaml]# Kubectl get pods--namespace=kube-system-o wide
NAME ready STATUS Restarts IP NODE
KUBERNETES-DASHBOARD-56BC76B6BB-B6KFX 1/1 Running 0 32s 172.18.0.194 Node1
[[email protected] yaml]# Kubectl Get Svc--namespace=kube-system
NAME TYPE cluster-ip external-ip PORT (S) Age
Kubernetes-dashboard nodeport 172.18.0.196 <none> 80:30003/tcp 13s
OK, create the success, next can access the node node (two nodes can choose one) 30003-port experience Kubernetes-dashboard through the browser:
CentOS7 Build Kubernetes Dashboard