1、导入kubernetes-dashboard 镜像
[root@node1 DNS]# docker load < kube-dashboard.tar
6bc90c4dba69: Loading layer [==================================================>] 86.48MB/86.48MB
5f70bf18a086: Loading layer [==================================================>] 1.024kB/1.024kB
Loaded image: mritd/kubernetes-dashboard-amd64:latest
2、准备好配置文件
[root@manager ~]# cat kubernetes-dashboard.yaml # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Configuration to deploy release version of the Dashboard UI. # # Example usage: kubectl create -f <this_file> kind: Deployment apiVersion: extensions/v1beta1 metadata: labels: app: kubernetes-dashboard name: kubernetes-dashboard namespace: kube-system spec: replicas: 1 selector: matchLabels: app: kubernetes-dashboard template: metadata: labels: app: kubernetes-dashboard # Comment the following annotation if Dashboard must not be deployed on master annotations: scheduler.alpha.kubernetes.io/tolerations: | [ { "key": "dedicated", "operator": "Equal", "value": "master", "effect": "NoSchedule" } ] spec: containers: - name: kubernetes-dashboard image: hub.c.163.com/allan1991/kubernetes-dashboard-amd64:v1.5.1 imagePullPolicy: IfNotPresent ports: - containerPort: 9090 protocol: TCP args: # Uncomment the following line to manually specify Kubernetes API server Host # If not specified, Dashboard will attempt to auto discover the API server and connect # to it. Uncomment only if the default does not work. - --apiserver-host=http://192.168.10.220:8080 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 --- kind: Service apiVersion: v1 metadata: labels: app: kubernetes-dashboard name: kubernetes-dashboard namespace: kube-system spec: type: NodePort ports: - port: 80 targetPort: 9090 selector: app: kubernetes-dashboard
[root@manager ~]# kubectl create -f kubernetes-dashboard.yaml deployment "kubernetes-dashboard" created service "kubernetes-dashboard" created [root@manager ~]# [root@manager ~]# kubectl get pods --namespace=kube-system -o wide NAME READY STATUS RESTARTS AGE IP NODE kube-dns-56d46f58f-6hhsl 3/3 Running 0 28m 10.0.71.4 192.168.10.222 kube-dns-56d46f58f-lnr86 3/3 Running 0 28m 10.0.91.4 192.168.10.221 kube-dns-56d46f58f-nbbxp 3/3 Running 0 28m 10.0.91.5 192.168.10.221 kubernetes-dashboard-7cbd9bccdc-g2kbc 1/1 Running 0 33s 10.0.71.5 192.168.10.222 [root@manager ~]# [root@manager ~]# kubectl get svc --namespace=kube-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kube-dns ClusterIP 10.10.10.2 <none> 53/UDP,53/TCP 28m kubernetes-dashboard NodePort 10.10.10.40 <none> 80:31493/TCP 44s
访问测试