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. Action
The following actions are all performed on the master node:
1. Edit Dashboard-controller.yaml, create dashboard pod
Pay attention to modifying the part of the red font!
Vim Dashboard-controller.yaml, with the following contents:
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:
Red font Explanation:
-
Mritd/kubernetes-dashboard-amd64: V1.5.1:dashboard Mirror, if you are not this image, be careful to modify the
-
--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, mapping the dashboard access port to the ports of two node host hosts for external access.
Vim Dashboard-service.yaml with the following contents:
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:
Red font Explanation:
Port refers to service ports
Targetport refers to the port of the pod
Nodeport is the port where the host is node, k8s external Access dashboard
Create dashboard
Kubectl create-f dashboard-controller.yaml
Results display: Deployment "Kubernetes-dashboard" created
kubectl create-f Dashboard-service.yaml
Results display: Service "Kubernetes-dashboard" created
View creation Result:
[[email protected] yaml]# kubectl get pods--namespace=kube-system-o wide
NAME ready STATUS Restarts age 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< Br>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